apply_filters ( 'jetpack_sitemap_post_types' )

The array of post types to be included in the sitemap.<p>Add your custom post type name to the array to have posts of that type included in the sitemap. The default array includes 'page' and 'post'.</p> <p>The result of this filter is cached in an option, 'jetpack_sitemap_post_types', so this filter only has to be applied once per generation.</p>

Source file: modules/sitemaps/sitemap-builder.php

View in GitHub

Changelog

Since: Jetpack 4.8.0


Notes

The following example adds WooCommerce products to the sitemaps.

add_filter( 'jetpack_sitemap_post_types', 'htdat_jetpack_sitemap_post_types' ); 

function htdat_jetpack_sitemap_post_types( $post_types ) {
	$post_types[] = 'product';
	return $post_types; 
}

Tutorials

Have a note to contribute?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Comments

  1. Jaybliss says:

    Please, how can i exclude/remove images in my sitemap ? Am using Jetpack

  2. Sarmad Gardezi says:

    Tell me where I should put my custom post type code and how to add my own build cpt in the sitemap.