Yesterday after upgrading WordPress PHP to version 7.2 from 5.6, I suddenly noticed an issue with
Sitemap.xml file generated by
Yoast SEO plugin.
Well, let me mention first, there isn’t any issue with Yoast SEO plugin but something between the plugin and
PHP 7.2 version which I still haven’t figured it out.
If you own a WordPress site then absolutely I would recommend you upgrade site to PHP 7.2. I made a mistake not upgrading site to PHP 7.2 before. Speed improvements and performance gain you will get are tremendous.
Currently on Crunchify, Sitemap has been fixed by a quick workaround though.
Let’s get started on what happened:
Below are the sequence of changes I’ve performed yesterday.
- Updated PHP version to 7.2 via cPanel
- Updated WP Super Cache to latest version
- Using Yoast SEO 4.6 as of now
- Went to sitemap link which is
- Saw above
plain textsitemap on page 🙁
- Immediately after that I changed PHP version to 5.6 and issue resolved and it was rendering right.
But there was a problem. Speed performance and gain what we got by moving to PHP 7.2 was gone. So I switched backed PHP to 7.2 to debug further.
How did I fix this then?
- I disabled / enabled again few plugins but not luck.
- I noticed, sitemap files are cached using WP Super Cache plugin.
disabled cachingon Sitemap
And immediately after that
issue resolved. So far the solution is working fine without any issue but I’m still not sure about the root cause.
Let me know if you find a permanent solution.