Software Developer

Exclude Certain Post IDs From JetPack Sitemap

This is how to exclude, or skip, certain posts from the Jetpack sitemap.

You must change 47, 48, 49 on line 2 to your own post IDs that you want to exclude from the sitemap. The post IDs must be separated by a comma.

This code goes into your functions.

PHP

function isa_sitemap_exclude_pages( $skip, $post ) {
	if ( in_array( $post->ID, array( 47, 48, 49 ) ) ) {
		$skip = true;
	}
	return $skip;
}
add_filter( 'jetpack_sitemap_skip_post', 'isa_sitemap_exclude_pages', 10, 2 );

By

Questions and Comments are Welcome

Your email address will not be published. All comments will be moderated.

Please wrap code in "code" bracket tags like this:

[code]

YOUR CODE HERE 

[/code]