1. Home
  2. Knowledge Base
  3. SEO Suite
  4. Remove Blank Lines from Sitemaps

Remove Blank Lines from Sitemaps

Rank Math makes it extremely easy to configure your sitemaps – learn more about how to get started with sitemaps here. However, in some cases, you may encounter empty lines present in your sitemap. These empty lines are likely caused by other plugins or themes that are in use on your site.

These are likely caused by using a multilingual plugin like WPML but leaving the translations halfway.

Here’s what this can look like:

Blank Lines in SItemap

You can solve this issue with the help of the following code in the theme’s functions.php file placing it at the very end:

add_filter('rank_math/sitemap/entry', function ($url){
    if (isset($url['loc']) && empty($url['loc'])) {
        return false;
    }    return $url;
});

We hope that you can now solve this issue easily. If you are still facing a problem, then please feel free to contact our support team. We are available 24×7, 365 days a year will help you out as soon as possible.

Still not using Rank Math?

Setup takes less than 5 minutes including the import from your old SEO Plugin!

Know more about the PRO Version

Was this article helpful?

Still need help?

?

Submit Your Question

Please give us the details, our support team will get back to you.

Open Ticket

Related Articles