apply_filters ( 'jetpack_sitemap_skip_post', bool $skip, object $post )

Filter condition to allow skipping specific posts in sitemap.

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

View in GitHub



(bool) Current boolean. False by default, so no post is skipped.


(object) Current post in the form of a $wpdb result object. Not WP_Post.


Since: Jetpack 3.9.0


You can use this filter to remove specific posts from your sitemap, like so:

function jetpackcom_sitemap_exclude_post( $skip, $post ) {
        if ( 2146 == intval( $post->ID ) ) {
                $skip = true;
        return $skip;
add_filter( 'jetpack_sitemap_skip_post', 'jetpackcom_sitemap_exclude_post', 10, 2 );

Have a note to contribute?

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

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

Google photo

You are commenting using your Google 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


  1. Shea says:

    Why is $skip set to false if the post does not match? This means that only the final instance of this snippet will have any effect – all the previous instances will be overridden.

    Additionally, I am not sure why the post ID here is a string, when it’s an integer in WP_Post.

  2. metamotion says:

    How should this filter code be used? Where should it be placed?

  3. Gene says:

    Can someone tell me why this snippet is not working?

    I’m using a Snippets plugin.

    function jetpackcom_sitemap_exclude_post( $skip, $post ) {
            if ( 77 === $post->ID ) {
                    $skip = true;
            return $skip;
    add_filter( 'jetpack_sitemap_skip_post', 'jetpackcom_sitemap_exclude_post', 10, 2 );