Make WordPress Core

Ticket #10791: multiple-post-types.2.patch

File multiple-post-types.2.patch, 1.1 KB (added by prettyboymp, 16 years ago)
  • query.php

     
    14861486                        }
    14871487                }
    14881488
    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                }
    14911495
    14921496                if ( !empty($qv['post_status']) )
    14931497                        $qv['post_status'] = preg_replace('|[^a-z0-9_,-]|', '', $qv['post_status']);
     
    20722076
    20732077                if ( 'any' == $post_type ) {
    20742078                        $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).')';
    20752085                } elseif ( ! empty( $post_type ) ) {
    20762086                        $where .= " AND $wpdb->posts.post_type = '$post_type'";
    20772087                } elseif ( $this->is_attachment ) {