[wp-trac] [WordPress Trac] #20647: get_post_type() returns nothing on custom post type archive pages with custom query and no results

WordPress Trac wp-trac at lists.automattic.com
Wed May 9 22:21:22 UTC 2012


#20647: get_post_type() returns nothing on custom post type archive pages with
custom query and no results
-----------------------------+------------------------------
 Reporter:  MikevHoenselaar  |       Owner:  MikevHoenselaar
     Type:  defect (bug)     |      Status:  closed
 Priority:  normal           |   Milestone:
Component:  Post Types       |     Version:  3.3.2
 Severity:  normal           |  Resolution:  invalid
 Keywords:  needs-patch      |
-----------------------------+------------------------------

Comment (by scribu):

 Oh, and if you absolutely need a function that uses the query vars,
 there's get_queried_object(), which will return the post type object, if
 called from a post type archive.

 Let's keep get_post_type() tied to the $post global, for the sake of
 everyone's sanity.

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


More information about the wp-trac mailing list