[wp-trac] [WordPress Trac] #18614: post_type_archive_title doesn't work when tax_query is added to wp_query

WordPress Trac wp-trac at lists.automattic.com
Mon Feb 13 16:52:58 UTC 2012


#18614: post_type_archive_title doesn't work when tax_query is added to wp_query
-----------------------------------+------------------------------
 Reporter:  wonderboymusic         |       Owner:
     Type:  defect (bug)           |      Status:  reopened
 Priority:  normal                 |   Milestone:  Awaiting Review
Component:  Template               |     Version:  3.2
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |
-----------------------------------+------------------------------

Comment (by nacin):

 [attachment:18614.diff] is the first pass at different route to solve the
 larger problem here, which includes #19939 as well as this ticket.

 [attachment:18614.2.diff] is a second take, which, primarily, does not re-
 order anything in get_queried_object(). What both patches do make sure of,
 though, is that is_post_type_archive() is always requested prior to
 taxonomy data.

 This was a bit inconsistent in the original implementation. wp_title() is
 going to be correct since it will always allow a post type archive to
 override a taxonomy. Given the hierarchy inherent to posts and terms, I
 would think that a post type archive should nearly always take precedence.
 While it is nearly impossible to tell the difference between /tag/some-
 tag/?post_type=type and /type/?tag=some-tag (and certainly so when rewrite
 rules are off), I think a good assumption would be that if the post type
 is has_archive = true, it is going to be the main target of a drill-down,
 rather than an option of a drill-down. (Or, at least, it is a higher
 priority than a tag or category in the subject of a drill-down, generally
 speaking.)

 I thought about get_queried_object( $type_of_object ),
 get_queried_objects(), and a few other things here. I think greater
 changes should wait for another day. For now, the attached patch attempts
 to bring post types above taxonomies when has_archive is true, and solve
 the current issue of template tags malfunctioning.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18614#comment:15>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list