xmlsf_skip_user

Filters the response when checking the author for exclusion flags in XML Sitemap context. Passes the user’s exclusion flag and $user; must return true or false.

apply_filters( 'xmlsf_skip_user', bool[] $skip, obj[] $user )

Used in xml-sitemap-feed/views/feed-sitemap-author.php

Parameters (2)

  • $skip
    (bool) The skip flag originally set to false.
  • $user
    (obj) The current user object.

Return

  • (bool) true|false

The filter should return a boolean value signifying the exclusion of the current post. Returning true will exclude the post from the XML Sitemap.

Usage example

function my_custom_skip_user( $skip, $user ) {
    // Add user IDs to this array.
    $skip_users = array( 12, 29, 136 );
    if ( ! is_object( $user ) || ! property_exists( $user, 'ID' ) || in_array(  $user->ID, $skip_users ) ) {
        $skip = true;
    }
    return $skip;
}
add_filter( 'xmlsf_skip_user', 'my_custom_skip_user', 10, 2 );

Related

Used byDescription
XMLSF_Sitemap_Plugin::filter_request()