[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
Wed Sep 7 19:10:32 UTC 2011


#18614: post_type_archive_title doesn't work when tax_query is added to wp_query
----------------------------+----------------------
 Reporter:  wonderboymusic  |       Owner:
     Type:  defect (bug)    |      Status:  closed
 Priority:  normal          |   Milestone:
Component:  Template        |     Version:  3.3
 Severity:  normal          |  Resolution:  wontfix
 Keywords:  has-patch       |
----------------------------+----------------------

Comment (by wonderboymusic):

 post_type_archive_title( ) exits if the current context is not
 post_type_archive( )  - meaning post_type is set in $wp_query.

 The name of the variable is $post_type_obj which leads me to believe it
 should always be a post type object, which get_queried_object isn't
 guaranteed to return.  Since post_type is in wp_query, get_post_type will
 work and get_post_type_object( get_post_type() ) will work and return a
 post_type_object, so then $post_type_obj->labels won't fail and log errors

 This isn't a band aid, writing a filter to correct what should be default
 functionality is

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


More information about the wp-trac mailing list