[wp-trac] [WordPress Trac] #10605: WordPress Shouldn't Mess with post_type

WordPress Trac wp-trac at lists.automattic.com
Thu Aug 13 13:50:17 UTC 2009


#10605: WordPress Shouldn't Mess with post_type
--------------------------+-------------------------------------------------
 Reporter:  filosofo      |       Owner:  ryan               
     Type:  defect (bug)  |      Status:  new                
 Priority:  normal        |   Milestone:  2.9                
Component:  Query         |     Version:                     
 Severity:  normal        |    Keywords:  post_type, wp_query
--------------------------+-------------------------------------------------
 I have a custom post_type, "restaurant," and I'd like to query for the
 "restaurant" with name "joes-diner".

 {{{
 query_posts(array(
    'post_type' => 'restaurant',
    'name' => 'joes-diner',
 ));
 }}}

 fails because WP sees that I'm querying by name, sets $wp_query->is_single
 to true, which in turn sets post_type to "post."

 If I wanted post_type to be "post" I wouldn't have specified "restaurant",
 would I?

 Patch uses the given post_type when specified.

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


More information about the wp-trac mailing list