Make WordPress Core

Ticket #14424: 14424.5.diff

File 14424.5.diff, 1.7 KB (added by nacin, 8 years ago)
  • src/wp-admin/includes/post.php

     
    934934                unset($q['post_mime_type']);
    935935
    936936        if ( isset($q['detached']) )
    937                 add_filter('posts_where', '_edit_attachments_query_helper');
     937                $q['post_parent'] = 0;
    938938
    939939        wp( $q );
    940940
    941         if ( isset($q['detached']) )
    942                 remove_filter('posts_where', '_edit_attachments_query_helper');
    943 
    944941        return array($post_mime_types, $avail_post_mime_types);
    945942}
    946943
    947 function _edit_attachments_query_helper($where) {
    948         global $wpdb;
    949         return $where .= " AND {$wpdb->posts}.post_parent < 1";
    950 }
    951 
    952944/**
    953945 * Returns the list of classes to be used by a metabox
    954946 *
  • src/wp-admin/includes/media.php

     
    22602260        if ( get_user_setting('uploader') )
    22612261                $form_class .= ' html-uploader';
    22622262
    2263         $_GET['paged'] = isset( $_GET['paged'] ) ? intval($_GET['paged']) : 0;
    2264         if ( $_GET['paged'] < 1 )
    2265                 $_GET['paged'] = 1;
    2266         $start = ( $_GET['paged'] - 1 ) * 10;
    2267         if ( $start < 1 )
    2268                 $start = 0;
    2269         add_filter( 'post_limits', create_function( '$a', "return 'LIMIT $start, 10';" ) );
     2263        $q = $_GET;
     2264        $q['posts_per_page'] = 10;
     2265        $q = isset( $q['paged'] ) ? intval( $q['paged'] ) : 0;
     2266        if ( $q['paged'] < 1 ) {
     2267                $q['paged'] = 1;
     2268        }
     2269        $q['offset'] = ( $q['paged'] - 1 ) * 10;
     2270        if ( $q['offset'] < 1 ) {
     2271                $q['offset'] = 0;
     2272        }
    22702273
    2271         list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
     2274        list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query( $q );
    22722275
    22732276?>
    22742277