Make WordPress Core

Changeset 13052


Ignore:
Timestamp:
02/10/2010 10:36:50 PM (14 years ago)
Author:
ryan
Message:

Consult exclude_from_search when retrieving post_status = any. see #9674

Location:
trunk/wp-includes
Files:
2 edited

Legend:

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

    r13050 r13052  
    8787    register_post_status( 'trash', array(   'label' => _x('Trash', 'post'),
    8888                                            'public' => true,
     89                                            'exclude_from_search' => true,
    8990                                            '_builtin' => true,
    9091                                            'label_count' => _n_noop('Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>')
     
    9394    register_post_status( 'auto-draft', array(  'label' => _x('Auto-Draft', 'post'),
    9495                                            'public' => false,
     96                                            'exclude_from_search' => true,
    9597                                            '_builtin' => true,
    9698                                            'label_count' => _n_noop('Auto-Draft <span class="count">(%s)</span>', 'Auto-Drafts <span class="count">(%s)</span>')
  • trunk/wp-includes/query.php

    r13049 r13052  
    20982098            $r_status = array();
    20992099            $p_status = array();
     2100            $e_status = array();
    21002101            if ( $q['post_status'] == 'any' ) {
    2101                 // @todo Use register_post_status() data to determine which states should be excluded.
    2102                 $r_status[] = "$wpdb->posts.post_status <> 'trash'";
     2102                foreach ( get_post_stati( array('exclude_from_search' => true) ) as $status )
     2103                    $e_status[] = "$wpdb->posts.post_status <> '$status'";
    21032104            } else {
    21042105                foreach ( get_post_stati() as $status ) {
     
    21172118            }
    21182119
     2120            if ( !empty($e_status) ) {
     2121                $statuswheres[] = "(" . join( ' AND ', $e_status ) . ")";
     2122            }
    21192123            if ( !empty($r_status) ) {
    21202124                if ( !empty($q['perm'] ) && 'editable' == $q['perm'] && !current_user_can("edit_others_{$post_type_cap}s") )
Note: See TracChangeset for help on using the changeset viewer.