Ticket #10791: multiple-post-types.2.patch
File multiple-post-types.2.patch, 1.1 KB (added by , 16 years ago) |
---|
-
query.php
1486 1486 } 1487 1487 } 1488 1488 1489 if ( !empty($qv['post_type']) ) 1490 $qv['post_type'] = sanitize_user($qv['post_type'], true); 1489 if ( !empty($qv['post_type']) ) { 1490 if(is_array($qv['post_type'])) 1491 $qv['post_type'] = array_map('sanitize_user', $qv['post_type'], array(true)); 1492 else 1493 $qv['post_type'] = sanitize_user($qv['post_type'], true); 1494 } 1491 1495 1492 1496 if ( !empty($qv['post_status']) ) 1493 1497 $qv['post_status'] = preg_replace('|[^a-z0-9_,-]|', '', $qv['post_status']); … … 2072 2076 2073 2077 if ( 'any' == $post_type ) { 2074 2078 $where .= " AND $wpdb->posts.post_type != 'revision'"; 2079 } elseif ( !empty( $post_type ) && is_array( $post_type ) && count($post_type) > 0) { 2080 $types_where = array(); 2081 foreach($post_type as $type) { 2082 $types_where[] = " $wpdb->posts.post_type = '$type'"; 2083 } 2084 $where .= ' AND ('.join(' OR', $types_where).')'; 2075 2085 } elseif ( ! empty( $post_type ) ) { 2076 2086 $where .= " AND $wpdb->posts.post_type = '$post_type'"; 2077 2087 } elseif ( $this->is_attachment ) {