[wp-trac] [WordPress Trac] #8872: post_type ignored when it shouldn't be

WordPress Trac wp-trac at lists.automattic.com
Fri Jan 16 23:57:17 GMT 2009


#8872: post_type ignored when it shouldn't be
--------------------------+-------------------------------------------------
 Reporter:  filosofo      |       Owner:  anonymous      
     Type:  defect (bug)  |      Status:  new            
 Priority:  normal        |   Milestone:  2.8            
Component:  General       |     Version:  2.8            
 Severity:  normal        |    Keywords:  post_type query
--------------------------+-------------------------------------------------
 Sometimes you might want to retrieve a post-like object when you're
 agnostic about what type of post it is (for example, you don't know
 whether it's a post, page, or attachment).

 This should work:

 {{{
 query_posts(array(
 'post_type' => 'any',
 'p' =>  123,
 ));
 }}}

 However, it doesn't because WP sees that the "p" is set, sets is_single to
 true, and then the logic for the post_type part of the where clause means
 that post_type gets set to 'post'.

 Instead, the where clause logic should give the "any" post_type priority,
 as it must be explicitly set (and therefore can be assumed to be the
 desired result).

 Patch give the "any" post_type priority.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/8872>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list