Sitemap Not Opening
-
The sitemap is not opening. It is showing error 404. I have turned on the XML sitemaps.
The page I need help with: [log in to see the link]
-
I had the same problems for a long time. I turned off the Yoast sitemaps and I started using the ‘standard’ sitemap from WordPress. It works smoothly and Search Console has no problems indexing.
After you switched it off just go to;
https://www.your-url.com/wp-sitemap.xml
I’ve modified some tweaks, in case you want to show more posts/pages in your feed or when you want to hide certain pages, for exampels tags of categories. Just add either of the lines below to your theme’s functions.php;
// WORDPRESS SITEMAP
// INCREASE URL COUNT FROM 1000 TO 5000 PER SITEMAP
add_filter( ‘wp_sitemaps_max_urls’, ‘filter_function_name_9755’, 10, 2 );
function filter_function_name_9755( $max_urls, $object_type ){
return 5000;
}// REMOVE USERS FROM SITEMAP
add_filter(
‘wp_sitemaps_add_provider’,
function( $provider, $name ) {
if ( ‘users’ === $name ) {
return false;
}
return $provider;
},
10,
2);// REMOVE CATEGORIES FROM SITEMAP
add_filter(
‘wp_sitemaps_taxonomies’,
function( $taxonomies ) {
unset( $taxonomies[‘category’] );
return $taxonomies;
}
);// REMOVE TAGS FROM SITEMAP
add_filter(
‘wp_sitemaps_taxonomies’,
function( $taxonomies ) {
unset( $taxonomies[‘post_tag’] );
return $taxonomies;
}
);// REMOVE PAGES FROM SITEMAP
add_filter(
‘wp_sitemaps_post_types’,
function( $post_types ) {
unset( $post_types[‘page’] );
return $post_types;
}
);Even after switching off the Yoast sitemaps, the WordPress sitemap shows the same error.
Can you go to settings > Permalinks and just click & save them again?
I did. But the error is not fixed yet.
Hello @sajjadbaqri
Thanks for reaching out about your XML sitemap. Please do the following:
- Go to Admin > Yoast SEO > Settings > General > Site features and confirm you have enabled the sitemap feature
- Go to Admin > Settings > Permalinks and click ‘Save Changes’ (without altering anything)
- Confirm you have published content that can appear in search results
- Ask your web host to add the required rules to your Apache or NGINX server
If the issue remains, we often see problems occur in combination with other plugins or themes. The fastest way to rule out any conflict is to deactivate all non-Yoast plugins and switch to a standard theme like Twenty Twenty-Two.
Please test this on your development or staging site if you have one. If not, we recommend using the Health Check & Troubleshooting plugin. This plugin has a troubleshooting mode, which does not affect normal visitors to your site. If you’re unfamiliar with checking for conflicts, we’d like to point you to a step-by-step guide to walk you through the process: How to check for plugin conflicts
If you feel uncomfortable doing this yourself or if this does not solve your issue, our Yoast SEO Premium plugin comes with one year of (technical) support.
My wordpress website shows 404 error when I open my website’s sitemap (even though XML sitemaps are on)
Secondly, it has to be noted that the 404 error page which is displayed is NOT the 404 error page of my theme. Instead, it is the 404 error page of Hostinger, my hosting provider. This problem also has to be fixed that why my Hostinger’s error page is displayed instead of displaying my Active Theme’s error page.
The irony is that I have another website using the same version of the same theme and plugins, but the error page is displayed correctly on that website (the error page of my theme is displayed instead of the error page of Hostinger). Besides, on that website, the sitemap works well and no error is shown when opening it. Therefore, this shows that the problems faced by me is not related to my theme or plugins.
I have created a staging environment stagin.iblagh.in – deactivated all non-Yoast plugins and switched to a standard theme?like?Twenty Twenty-Four. But still the 404 problem is not fixed.
But the issue still persists.
Update: The problem got fixed when I changed my permalinks from plain to post name. The 404 page and the Yoast XML stop working for some reason if the permalinks is set to plain. The problem is now fixed after I changed my permalinks to something else
- You must be logged in to reply to this topic.