[wp-trac] [WordPress Trac] #57816: WordPress shows author archive in sitemap even if there are no posts
WordPress Trac
noreply at wordpress.org
Wed Mar 1 10:37:34 UTC 2023
#57816: WordPress shows author archive in sitemap even if there are no posts
--------------------------+------------------------------
Reporter: zodiac1978 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Sitemaps | Version: 5.5
Severity: normal | Resolution:
Keywords: needs-patch | Focuses:
--------------------------+------------------------------
Comment (by amisiewicz):
Just to clarify, it does seem like a bug to me, but I may be missing
something. That's why I'm waiting for input from the other people / team
members before taking any action.
For now, I'm leaving the code to possibly fix this as a use of a filter
{{{#!php
<?php
add_filter( 'wp_sitemaps_users_query_args', function( $args ) {
if ( ( $key = array_search( 'page', $args['has_published_posts'] )
) !== false ) {
unset( $args['has_published_posts'][ $key ] );
}
return $args;
}, 10, 1 );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57816#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list