[wp-trac] [WordPress Trac] #14330: Multiple Post Type in Page Query Problem

WordPress Trac wp-trac at lists.automattic.com
Mon Aug 16 22:26:39 UTC 2010


#14330: Multiple Post Type in Page Query Problem
------------------------------+---------------------------------------------
 Reporter:  loushou           |        Owner:  loushou 
     Type:  defect (bug)      |       Status:  assigned
 Priority:  normal            |    Milestone:  3.1     
Component:  Query             |      Version:  3.0     
 Severity:  normal            |   Resolution:          
 Keywords:  has-patch commit  |  
------------------------------+---------------------------------------------
Changes (by scribu):

  * keywords:  has-patch => has-patch commit
  * severity:  major => normal


Comment:

 Replying to [comment:17 wpmuguru]:
 > That's where you are going wrong. Try
 >
 > {{{
 > get_posts('post_type=post_type_1,post_type_2');
 > }}}

 Yes, this works, but it doesn't fix the problem. Suppose one wants to
 implement a form that queries multiple post types:

 {{{
 <form method="get" action="">
   <input type="checkbox" name="post_type[]" value="post_type_1">
   <input type="checkbox" name="post_type[]" value="post_type_2">

 ...
 </form>
 }}}

 The resulting URL will be
 {{{post_type[]=post_type_1&post_type[]=post_type_2}}}, which is a
 perfectly reasonoable way to send query variables.

 Because of the current bug, you would have to add further code (either
 JavaScript or a 'request' hook) to transform it into
 'post_type=post_type_1,post_type_2', which is a waste.

 Still, since this is something that can be worked around and doesn't
 affect any part in Core, I think it's severity is 'normal'.

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


More information about the wp-trac mailing list