WordPress Sitemap problem hot fix

Share on FacebookTweet about this on TwitterPin on PinterestShare on Google+Share on LinkedIn

If you use WordPress Yoast Seo module you may have the problem of incorrect display of your Sitemap.

If you check your Sitemap using Yoast Seo Sitemap settings, you can see the following error:

problema sitemap wordpress

The problem doesn’t concert only Yoast SEO. If, for example, we disable Yoast sitemap installing another module, we could have the same error. WordPress Sitemap problem

The reason is very simple: in the header of the file sitemap.xml, or in its children files, there is a blank row.

We all know that php is the Server language for WordPress. Php modules are inserted in the html pages when they are sent to the requesting client (browser). The xml files, related to the sitemap, are created in the same way.

This means that if at least a php file has a blank row, the blank row would be positioned in the header or in the footer of your file. WordPress Sitemap problem

The problem rises only when the blank row is in the header. Infact, every xml reader expects to have the identification xml tag  <?xml version=”1.0″ …> in the first row.

If you want to correct this bug you have to verify the following files in the exact order. For each file you have to check that there are no empty rows in its header or in its footer. In every file you’ll find the opening server tag for php code: <?php. Before this tag you must not have any rows. In the end of some files you could have or not the closing tag. In both cases the file must not have any empty row in the footer. If your file doesn’t have the closing tag you don’t have to add one. WordPress Sitemap problem

If you find an empty row you can delete it and check if the sitemap problem is so solved.

  • wp-config.php : is in the root of our WordPress site.
  • wp-content\themes\<your theme>\functions.php
  • all the files of the plugins

For these last files the change will be less simple. WordPress Sitemap problem

You have to enter in the Plugin Editor. For each plugin of the drop-down list there are, in the right part, many files. Each file is a link. For each file you have to check if in the header there are one or more empty rows . You must delete each empty row you’ll find in the header and save the file (file update). Then you’ll check if the problem is solved .. and so on for all the files until the problem is finally solved.

How can you understand that the problem is solved? If the error you had at the beginning disappears and the sitemap becomes visible you have finally resolved the problem.

problema sitemap wordpress

To change the wp-config.php file you have to transfer it via ftp on our Personal Computer, check the file, correct it, if necessary, and send it via ftp to the web server that hosts the WordPress site. WordPress Sitemap problem

If you have some questions or if you want to express your opinion comment my article

If you want you can follow my course to open your First WordPress Site

You can follow my lesson to create your first WordPress plugin

WordPress Sitemap problem