[wp-trac] [WordPress Trac] #57816: WordPress shows author archive in sitemap even if there are no posts

WordPress Trac noreply at wordpress.org
Thu Jun 8 13:57:41 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:  Future Release
Component:  Sitemaps      |     Version:  5.5
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+-----------------------------

Comment (by swissspidy):

 The `WP_User_Query` in `WP_Sitemaps_Users` uses `'has_published_posts' to
 only list users with at least 1 published post in any post type (including
 pages, excluding attachments).

 Since pages are not normally shown in the author archives, we could add
 `unset( $public_post_types['page'] );` here:

 https://github.com/WordPress/wordpress-
 develop/blob/e2a747662ee018262a86ddfbc38cd7292bc911bb/src/wp-
 includes/sitemaps/providers/class-wp-sitemaps-users.php#L139-L140

 That said, the author archive for a user with no published posts returns a
 200 status (albeit an empty page), not a 404. So... not sure if that needs
 to be changed at all 🤷‍♂️

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57816#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list