Here we will learn how to disable the default XML Sitemap created on WordPress. Also methods to disable the default sitemap.xml created by Yoast SEO plugins. Beginners can easily implement it on their WordPress website.
If you create a website on WordPress then XML Sitemap is a very important part for SEO. It is important to have it on the website. Sitemap gives information about the available posts and pages of your website. Which helps the crawlers of Google and Bing to easily find the pages and posts created on your website.
Disadvantage of Default XML Sitemap
If XML sitemap is poorly created on your website then your website can never rank in the search results of Google or Bing. There are many problems in the default XML sitemap available on WordPress, for example, in WordPress’s default wp-sitemap.xml, commands are given to rank all pages, posts, tags, authors, and custom posts. Which you cannot remove even if you want to. If you try to remove it in any way, the ranking of your website may go down or it may never rank.
There is a solution to this problem. Remove the default sitemap. And create a sitemap from such a source in which give it commands for the search engine as per your choice. So that search consoles like Google and Bing know which posts of your website to rank and which not. Let’s face these problems.
Disable WordPress Default wp-sitemap.xml using Plugin
To disable the default wp-sitemap.xml created on WordPress, we will take the help of a plugin.
- For this go to the plugin section of WordPress
- Go to Add New Plugin and type ‘Disable WP Sitemaps‘ in the search box.
- Install the plugin and wait for a while.
- Once the plugin is installed, the default XML sitemap of your WordPress website will be deleted and a 404 error page will appear.
Disable WordPress Default wp-sitemap.xml without Plugin
Now we will remove the default wp-sitemap.xml created on WordPress without any plugin. For this we will take the help of a PHP function code. This method will help improve the security and performance of WordPress. And can protect against the harm of third party plugins. Let us know this method.
- Add the following php function code to the functions.php file of your WPCode snippet plugin or WordPress theme.
add_filter( 'wp_sitemaps_enabled', '__return_false' );
Using Theme functions.php:
Go to the Theme Editor in the Themes section of WordPress. Then navigate to the files section of functions.php. Then add the above code at the very end of functions.php. And save it WordPress’s default XML file will be deleted in a few seconds.
Using WPCode Snippet:
- Now install the WPCode Snippet plugin in the second method
- Then click on Add Snippet and select Add Your Custom Code (New Snippet)
- Now install the WPCode Snippet plugin in the second method
- Then click on Add Snippet and select Add Your Custom Code (New Snippet)
- Enter any name in the title name
- Select PHP snippets in the code field
- paste the code into the editor, then save
- When you save the website, the default wp-sitemap.xml will be removed
Remove Yoast Default Sitemap
To remove sitemap_index.xml auto generated by Yoast SEO. Go to this direction Yoast>Settings>Site features. And at the very end of this page, disable the features of XML sitemaps. The default sitemap will be removed in a short time.