Like today our WordPress Developer team fetch issue in one of our client’s leading wordpress site as XML sitemap generated by WordPress Yoast SEO plugin not work well and on hit sitemap page url it show error like below instead of well form xml sitemap feed.
After Search on web see that this kind issue happen due to opening whitespace outside of the tags so to find out whitespace and solve out error “error on line 2 at column 6: XML declaration allowed only at the start of the document” we worked on following step to find out white space & rid out it
- for white space Check theme functions.php & wordpress core main index.php & wp-config.php file
- Deactivated all plugins
- Switch theme to WP default theme
- Updated WordPress
After all still issue unsolved.
What work for us to Delete Blank Lines and solve Fix WordPress Feed XML Parsing Errors with WordPress Yoast SEO plugin ?
WordPress leading whitespace fix to make working your WordPress site XML & other feed url.
Like us Michal also fetch similar issue and spend couple of hours to find out white space in the active WordPress plugins & theme which broke XML feed.
As all time when ever this kind issue all we need to spend number of hours to find out whitespace Michal developed very us script and with help of that we can solve out issue within 2 minutes.
Step to solve out WhiteSpace issue in WordPress by wejnswpwhitespacefix script.
- Download http://wejn.org/stuff/wejnswpwhitespacefix.php
- Upload to your wordpress setup root directory
- Include wejnswpwhitespacefix.php file at first thing in WP index.php file like below code
Tips : For better rank performance in Search Result check your feeds regularly and take care of the blank lines when you editing PHP files.