[wp-trac] [WordPress Trac] #50070: 'post_type' query variable not set for taxonomy queries

WordPress Trac noreply at wordpress.org
Sun May 17 01:22:34 UTC 2020


#50070: 'post_type' query variable not set for taxonomy queries
--------------------------+------------------------------
 Reporter:  aurovrata     |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Query         |     Version:  5.4
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by Howdy_McGee):

 The easiest way to see this is to print a Taxonomy archive query. Using
 hooks as the question mentioned `posts_where` and `posts_join` show empty
 post type even as the method keeps the post type in an un-passed
 `$post_type` variable.

 Honestly, I think if we're going to juggle post type we should do so as
 the Query post type `$q['post_type']`. This would ensure whatever hooks
 appear in the future will have an accurate Post Type.

 The given patch is the easy route and simply applies the current
 `$post_type` if the query post type index is empty.

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


More information about the wp-trac mailing list