WordPress.org

Make WordPress Core

Changeset 14121


Ignore:
Timestamp:
04/17/10 09:03:33 (4 years ago)
Author:
dd32
Message:

Respect the post_type param for Taxonomy Queries, Props Otto & Dougal Campbell. Restrict Attachment post_status joins to queries involving attachment results ("any" or "attachment"). See #13020

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/query.php

    r14108 r14121  
    20322032                if ( !is_wp_error($post_ids) && !empty($post_ids) ) { 
    20332033                    $whichcat .= " AND $wpdb->posts.ID IN (" . implode(', ', $post_ids) . ") "; 
    2034                     $post_type = 'any'; 
     2034                    if ( '' === $post_type ) { 
     2035                        $post_type = 'any'; 
     2036                        $post_status_join = true; 
     2037                    } elseif ( in_array('attachment', (array)$post_type) ) { 
     2038                        $post_status_join = true; 
     2039                    } 
    20352040                    $q['post_status'] = 'publish'; 
    2036                     $post_status_join = true; 
    20372041                } else { 
    20382042                    $whichcat = " AND 0 "; 
     
    22932297        if ( empty($q['nopaging']) && !$this->is_singular ) { 
    22942298            $page = absint($q['paged']); 
    2295             if (empty($page)) { 
     2299            if ( empty($page) ) 
    22962300                $page = 1; 
    2297             } 
    22982301 
    22992302            if ( empty($q['offset']) ) { 
Note: See TracChangeset for help on using the changeset viewer.