Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi, yes there is the filter xmlsf_skip_user available for this. You can use a code snippets plugin or your theme’s functions.php to add some PHP like this:

    function my_skip_authors_sitemap( $skip, $user ) {
        $skip_users = array( 12, 15 );
        if ( ! is_object( $user ) || ! method_exists( $user->ID ) || in_array(  $user->ID, $skip_users ) ) {
            $skip = true;
        }
        return $skip;
    }
    add_filter( 'xmlsf_skip_user', 'my_skip_authors_sitemap', 10, 2 );

    Add as many authors by their ID number (separated by a comma) as you wish to exclude to the $skip_users array.

    Thread Starter enzodek1

    (@enzodek1)

    Thanks.

    It gave me an error on the method check, but deleting the check works fine.

    I turned

    if ( ! is_object( $user ) || ! method_exists( $user->ID ) || in_array( $user->ID, $skip_users ) )
    into

    if ( ! is_object( $user ) || in_array( $user->ID, $skip_users ) )

    Sorry, my mistake. And good spot: the part ! method_exists( $user->ID ) should actually have been ! property_exists( $user, 'ID' )

    Good to hear you got it working ??

    Thread Starter enzodek1

    (@enzodek1)

    thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Remove author from sitemap’ is closed to new replies.