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

WordPress Trac wp-trac at lists.automattic.com
Sat Jul 17 00:41:33 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:  major         |   Resolution:          
 Keywords:  needs-patch   |  
--------------------------+-------------------------------------------------

Comment(by scribu):

 Also, instead of

 {{{
 foreach ($this->query_vars['post_type'] as $key => $pType)
     if ( ! in_array( $pType, $queryable_post_types ) )
         unset( $this->query_vars['post_type'][$key] );
 }}}

 it would be more elegant to use array_intersect:

 {{{
 $this->query_vars['post_type'] = array_intersect(
 $this->query_vars['post_type'], $queryable_post_types );
 }}}

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


More information about the wp-trac mailing list