News sitemap doesn’t work when I have Custom Post Type ‘News’

Last update: 06 March, 2018

Yoast SEO: News will automatically detect a naming collision and change the news sitemap name. Please go to Admin > SEO > News SEO and click the 'XML News sitemap' link to get the correct sitemap URL. If you prefer to give your news sitemap a custom name, please use the developer filter discussed below.

How to Change the News Sitemap URL

This guide is written for advanced users and developers. Looking for a web developer to customize our plugin? We highly recommend checking out Code Poet as they have a great list of available freelance WordPress developers.
Disable all sitemaps by unchecking the sitemap box shown in this article.
Add the following to your functions.php file.

/* Change Yoast News sitemap when custom post news conflicts */
function wpseo_change_news_sitemap() { return "google_news"; }
add_filter('wpseo_news_sitemap_name', 'wpseo_change_news_sitemap');
Enable all sitemaps by following the steps in this article.

This will create two sitemaps; one for the news custom post type and one specifically formatted to meet Google News guidelines.

News Post Type =
Google News Format =

Was this article helpful? ·