[wp-trac] [WordPress Trac] #21660: 'p' arg should work with custom post types

WordPress Trac wp-trac at lists.automattic.com
Thu Aug 23 02:01:56 UTC 2012


#21660: 'p' arg should work with custom post types
--------------------------+------------------------------
 Reporter:  batmoo        |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Query         |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------------------

Comment (by dd32):

 I would argue that 'p' is a query for the Post post_type, same as
 'page_id' is a query for Pages.  We also have `post__in` but that accepts
 an array of Post post_id's only.  Adding a specific `post_id` query var (a
 private one I assume for use only from within code) seems to be suggesting
 one should be using `get_post( $post_id );`.

 I'd expect that example to be written something like this, which is a lot
 more portable, and should work exactly as you're intending
 {{{
 $query = new WP_Query( array( 'cpt_query_var' => 'cpt_post_slug' ) );
 }}}

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


More information about the wp-trac mailing list