WordPress.org

Make WordPress Core

Changeset 12706


Ignore:
Timestamp:
01/12/10 15:23:10 (4 years ago)
Author:
ryan
Message:

Make wp_edit_posts_query() more post_type aware. Use array calling style. see #9674

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit.php

    r12597 r12706  
    2525else 
    2626    $post_type = 'post'; 
     27$_GET['post_type'] = $post_type; 
    2728 
    2829$post_type_object = get_post_type_object($post_type); 
  • trunk/wp-admin/includes/post.php

    r12702 r12706  
    829829    $post_stati = apply_filters('post_stati', $post_stati); 
    830830 
    831     $avail_post_stati = get_available_post_statuses('post'); 
    832  
    833     $post_status_q = ''; 
     831    if ( isset($q['post_type']) && in_array( $q['post_type'], get_post_types( array('_show' => true) ) ) ) 
     832        $post_type = $q['post_type']; 
     833    else 
     834        $post_type = 'post'; 
     835 
     836    $avail_post_stati = get_available_post_statuses($post_type); 
     837 
    834838    if ( isset($q['post_status']) && in_array( $q['post_status'], array_keys($post_stati) ) ) { 
    835         $post_status_q = '&post_status=' . $q['post_status']; 
    836         $post_status_q .= '&perm=readable'; 
     839        $post_status = $q['post_status']; 
     840        $perm = 'readable'; 
    837841    } 
    838842 
     
    848852    } 
    849853 
    850     $post_type_q = 'post_type=post'; 
    851     if ( isset($q['post_type']) && in_array( $q['post_type'], get_post_types( array('_show' => true) ) ) ) 
    852         $post_type_q = 'post_type=' . $q['post_type']; 
    853  
    854  
    855854    $posts_per_page = (int) get_user_option( 'edit_per_page' ); 
    856855    if ( empty( $posts_per_page ) || $posts_per_page < 1 ) 
     
    858857    $posts_per_page = apply_filters( 'edit_posts_per_page', $posts_per_page ); 
    859858 
    860     wp("$post_type_q&$post_status_q&posts_per_page=$posts_per_page&order=$order&orderby=$orderby"); 
     859    wp( compact('post_type', 'post_status', 'perm', 'order', 'orderby', 'posts_per_page') ); 
    861860 
    862861    return array($post_stati, $avail_post_stati); 
Note: See TracChangeset for help on using the changeset viewer.