Sitemaps: add Custom Post Type support

Explore the benefits of Jetpack

Learn how Jetpack can help you protect, speed up, and grow your WordPress site. Get up to 70% off your first year.

Explore plans

By default, Jetpack’s new Sitemaps module supports Posts and Pages. It also supports Jetpack’s Custom Content Types if you use them on your site.

If you’d like to add support for another Custom Post Type, you can use the jetpack_sitemap_post_types filter, like so:

function jeherve_add_cpt_sitemaps( $post_types ) {
	$post_types[] = 'your_post_type';
	return $post_types;
}
add_filter( 'jetpack_sitemap_post_types', 'jeherve_add_cpt_sitemaps' );

Fore more details, see the page on how to use filters to customize Jetpack.

This entry was posted in Code snippets and tagged , , , . Bookmark the permalink.

Jeremy Herve profile
Jeremy Herve

Jetpack Mechanic 🚀 at Automattic. WordPress, board games, TV Series, music.

Explore the benefits of Jetpack

Learn how Jetpack can help you protect, speed up, and grow your WordPress site. Get up to 70% off your first year.

Explore plans

Have a question?

Comments are closed for this article, but we're still here to help! Visit the support forum and we'll be happy to answer any questions.

View support forum