Yoast SEO Plugin XML Sitemap

The WordPress SEO plugin by Yoast includes options to generate an XML sitemap for your website. Search engines look at all of the URLs in this file when indexing your content, and it helps to make sure that nothing is missed, and newly added pages (or files) are found quickly.

When you first submit your sitemap index file to Google Webmaster Tools (you must do this manually), it is processed and remembered. You don’t necessarily have to resubmit the sitemap again, as changes to it will be read automatically by Google—but, this doesn’t always happen quickly. Especially for sites that do not change that frequently or have a low pagerank. Google and some others on the web suggest using the ping URL or resubmitting via Webmaster Tools. [1] [2] [3]

Yoast automatically uses ping to give Google a nudge to say, “Hey, where have you been? My existing XML sitemap is updated. Please take a look.” This is done on a regular basis, and when content is added or edited within WordPress. But what if you want to disable this, so you can manually resubmit or ping?

How to Disable Automatic Search Engine Pinging

If you’re not sure if you should do this, don’t. Why would you want to disable the automatic pinging? In our case, we were working with a very large site and an SEO company that was trying to get it all under control. With the sitemap automatically resubmitting all the time, its status would change in Webmaster tools at unwanted times and start processing thousands of URLs again. It was driving them crazy! In their words:

Please, please, please can we switch the resubmit off before I circumnavigate the moon under my own steam!

At first, it was unclear from the docs and various pages I was googling that Yoast was actually doing the resubmitting. I eventually had to go into the source code to confirm that it is. Here it is in wp-seofunctions.php. Note that it pings both Bing and Google. The filter in this function was the key to disabling the pinging (at the time of writing, this filter is not documented).

Simply adding this line to your theme’s functions.php should do the trick:

What this does is hook into the filter and set the value to false. So Yoast’s ping function returns before it does anything. The callback function being used __return_false, is one of WordPress’ built in functions for quickly returning common values (like “true”, or “null”).

 

Leave a Reply

You can use the <pre> tag to post a block of code, or <code> to highlight code within text.