Disable Default Wordpress Sitemap

Disable Default Wordpress Sitemap
Page content

How to disable the default wordpress sitemap

Wordpress is the favorite CMS of millions of users because of its ease of use, excellent features, and the thousands of plugins and themes that make it easier to improve Wordpress functionality to suit various styles of needs. You can create nearly all types of websites in Wordpress including ecommerce sites, portfolio sites, business and educational websites, blogs and so on.

Another important fact that Wordpress is the favorite of so many users is that you can manage SEO in Wordpress with much more ease compared to any other CMS. While there are several CMS that are in use now, Wordpress still continues to rank at the top and its SEO features are a critical factor behind its popularity.

You can easily manage SEO in Wordpress using a dedicated SEO plugin that will generate the schema for posts and pages as well as archives and other pages and help you rank higher. There are also a few inbuilt SEO features including the default sitemap which was introduced by Wordpress in its version 5.5 release.

If you do not want to use a SEO plugin to generate a sitemap for your Wordpress website, the default sitemap might work. However, the default sitemap is rather too basic for a Wordpress website and could not offer you the same benefits like the ones generated by plugins such as Rank Math, Yoast or AIOSEO do. You can also use a dedicated sitemap plugin to generate a sitemap like Google sitemaps plugin or generate a sitemap online and then upload it to your root folder.

The easiest method to get a sitemap for your Wordpress website is to generate one using a dedicated SEO plugin like Yoast, RankMath or AIOSEO. These plugins output an advanced sitemap that offers superior SEO benefits compared to the basic one generated by Wordpress by default. However, if you are unaware of the existence of the default sitemap on your website, you may end up having two on your website.

A sitemap is a critical component of Wordpress SEO and helps Google crawl your website and find pages easily that need to be indexed. Even if you are not using Wordpress, a sitemap is critical to get your website crawled well and rank higher. You should also include the sitemap in your Robots.txt file so that Google can easily discover it and index the pages listed in your sitemap.

So, we were talking about the default sitemap generated by Wordpress and what to do with it. You can keep it if SEO is not a major concern for you. However, that is not the case generally since people want their websites to rank as well as possible and therefore it is recommended to use and advanced and superior version of xml sitemap rather than depend on the default one produced by Wordpress.

How to deal with the default wordpress sitemap?

If you want to check out you can see the default Wordpress sitemap at yourdomain.com/wp-sitemap.xml and if you have not dealt with it yet, it might still be loading on your website. There are two main ways to deal with the default sitemap on your blog/website.

Redirect the default sitemap

The easier way is to use a redirect to redirect the default wordpress sitemap to the one that you want Google to crawl. You can easily set a redirect using the redirection plugin. If you do not want to use a plugin, the redirect can be enabled by the .htaccess file.

To enable the redirect through the .htaccess file:

Redirect 301 /wp-sitemap.xml https://example.com/sitemap.xml

Just add your own sitemap url at the end of the redirect (replace example.com/sitemap.xml) and the default Wordpress sitemap will also redirect to the other one.

So, this is one method of dealing with the default sitemap and it is an effective method. Whether any bot or human tries to visit the default sitemap, will be redirected to the other sitemap that you want them to check out.

The other method of dealing with the default sitemap is to totally remove it from your website or disable the function that generates the default sitemap in Wordpress. It is also easy and will require you to edit some code on your website.

Disable the default sitemap with code

Another method to effectively get rid of the default Wordpress sitemap is to remove it using a php function. It is just a one line of code that you can easily add to your theme’s functions.php file at the bottom. If you are confident about editing the file, you can add the code directly or you can create a child theme before making any changes. Just copy and paste the code into the functions,php file at the bottom.

 add_filter( 'wp_sitemaps_enabled', '__return_false' );

That’s all. Now, if you visit the default sitemap url, you will come against a 404 error page. If you want to avoid the 404 error, you can use the first method we discussed of .htaccess redirect.

However, there is also a plugin named code snippets that you can use to add the piece of code into your site. Adding code using the code snippets plugin is easy. You can install the plugin and activate just as you install any plugin. Now, just check out the left sidebar and click on add a snippet. Post the code in the snippet box and give the code snippet a name like - “disable default sitemap”. Click on save and activate the plugin.

Code to disable default sitemap

In case, you do not want to use any of the two methods above, you can use another plugin called disable default Wordpress sitemap to disable the default sitemap creation function.

Use AIOSEO Plugin

The AIOSEO plugin is an excellent plugin for managing SEO. If you are using this plugin on your website, you need not do anything to disable the default sitemap. If you have activated the sitemap function in the AIOSEO plugin, it will automatically disable the function that generates the default Wordpress sitemap. Otherwise, you can install the AIOSEO plugin and enable the xml sitemap. This will generate a better and more optimized sitemap for your Wordpress website and will also automatically disable the default sitemap.