sitemap xml missing in wordpress using yoasts plugin
Some times sitemap xml missing in WordPress using yoasts plugin how this happen ? do you wonder about this issue ? .Yes I am also faced the same issue and wonder about it because the issue comes suddenly when I check my webmaster tool 404 error sitemap missing. So the Google failed to crawl my sitemap xml.
Then I checked in detailed about the issue , because when I installed yoast plugin in my site it was working and suddenly it stops creating xml file. So I Googled and I got the .htaccess fix for the plugin as follows.By editing .htaccess file in the root or in WordPress admin dashboard SEO->Edit files option. and paste the following codes.
# WordPress SEO - XML Sitemap Rewrite Fix
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^sitemap_index\.xml$ /index.php?sitemap=1 [L]
RewriteRule ^([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 [L]
</IfModule>
# END WordPress SEO - XML Sitemap Rewrite Fix
But unfortunately this htaccess fix was not works for me. So I checked again then i got an edit core file of seo yoast plugin and it will fix the issue.The above solution do not works for you then you can try the following fix. First take class-sitemaps.php from the location “/wp-content/plugins/wordpress-seo/inc/class-sitemaps.php”. and search for the init(). and edit it as follows.
function init() {
global $wp_rewrite;
$GLOBALS['wp']->add_query_var( 'sitemap' );
$GLOBALS['wp']->add_query_var( 'sitemap_n' );
$GLOBALS['wp']->add_query_var( 'xsl' );
$this->max_entries = ( isset( $this->options['entries-per-page'] ) && $this->options['entries-per-page'] != '' ) ? intval( $this->options['entries-per-page'] ) : 1000;
add_rewrite_rule( 'sitemap_index\.xml$', 'index.php?sitemap=1', 'top' );
add_rewrite_rule( '([^/]+?)-sitemap([0-9]+)?\.xml$', 'index.php?sitemap=$matches[1]&sitemap_n=$matches[2]', 'top' );
add_rewrite_rule( 'sitemap\.xsl$', 'index.php?xsl=1', 'top' );
$wp_rewrite->flush_rules();
}
Then you just create the xml file from seo menu of WordPress and check your file was generated. Its works like charm 🙂 but keep in mind its core file edit so please note it in some where to keep as a log then only you can go with updates. anyway sitemap xml missing in WordPress using yoast plugin issue get fixed right ? 🙂 🙂
4 thoughts on “sitemap xml missing in wordpress using yoasts plugin”
Thanks very interesting blog!
Awesome thanks! That helps with my sitemap issues alright!
Glad to know its helps you..
You got a very great website walkswithme, Glad I noticed it through bing.