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

Remove Blank Lines from Sitemaps

First of all, we hope that you can easily configure your sitemaps with the help of the Rank Math plugin.

However, there can be situations wherein many empty lines are present in the Sitemaps. These empty lines are probably caused by other plugins or the theme that you might be using.  These are likely caused by using a multilingual plugin like WPML but leaving the translations half-way.

Below is an example of this issue:

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 and will help you with any issues that you might face.

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