WordPress.org

Make WordPress Core

Changeset 21322


Ignore:
Timestamp:
07/25/2012 04:13:13 PM (8 years ago)
Author:
ryan
Message:

Fix per_page screen option for custom post types and taxonomies. Don't convert taxonomy and post type slugs from hyphen to underscore when saving the per_page usermeta. Props nacin. see #18958

Location:
trunk/wp-admin
Files:
3 edited

Legend:

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

    r21311 r21322  
    3737}
    3838
    39 add_screen_option( 'per_page', array('label' => $title, 'default' => 20, 'option' => 'edit_' . $tax->name . '_per_page') );
     39add_screen_option( 'per_page', array( 'label' => $title, 'default' => 20, 'option' => 'edit_' . $tax->name . '_per_page' ) );
    4040
    4141switch ( $wp_list_table->current_action() ) {
  • trunk/wp-admin/edit.php

    r20630 r21322  
    216216}
    217217
    218 add_screen_option( 'per_page', array('label' => $title, 'default' => 20) );
     218add_screen_option( 'per_page', array( 'label' => $title, 'default' => 20, 'option' => 'edit_' . $post_type . '_per_page' ) );
    219219
    220220require_once('./admin-header.php');
  • trunk/wp-admin/includes/misc.php

    r20417 r21322  
    329329            return;
    330330
    331         $option = str_replace('-', '_', $option);
    332 
    333331        $map_option = $option;
    334332        $type = str_replace('edit_', '', $map_option);
    335333        $type = str_replace('_per_page', '', $type);
    336         if ( in_array($type, get_post_types()) )
     334        if ( in_array( $type, get_taxonomies() ) )
     335            $map_option = 'edit_tags_per_page';
     336        elseif ( in_array( $type, get_post_types() ) )
    337337            $map_option = 'edit_per_page';
    338         if ( in_array( $type, get_taxonomies()) )
    339             $map_option = 'edit_tags_per_page';
     338        else
     339            $option = str_replace('-', '_', $option);
    340340
    341341        switch ( $map_option ) {
Note: See TracChangeset for help on using the changeset viewer.