[wp-trac] [WordPress Trac] #19465: 'Show on screen' (per_page) options don't save for certain custom taxonomies

WordPress Trac wp-trac at lists.automattic.com
Wed Dec 7 14:39:40 UTC 2011


#19465: 'Show on screen' (per_page) options don't save for certain custom
taxonomies
----------------------------+-----------------------------
 Reporter:  jolley_small    |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Administration  |    Version:  3.3
 Severity:  normal          |   Keywords:
----------------------------+-----------------------------
 I've identified 2 situations where the screen options don't save
 (per_page) when administrating custom taxonomies:

 1) When a taxonomy's name contains an integer
 2) When a taxonomy's name contains a hyphen (-)

 The first issue is due to a line in misc.php set_screen_options():

 {{{
 if ( !preg_match( '/^[a-z_-]+$/', $option ) )
                         return;
 }}}

 This returns (not saving the option) if the taxonomy contains numbers.
 This preg_match should be expanded to also allow integers.

 The second issue is due to this line in the same function:

 {{{
 $option = str_replace('-', '_', $option);
 }}}

 That replaces hyphens with underscores, which would be fine, however, the
 function in screen.php (render_per_page_options) which loads the options
 contains this:

 {{{
 $option = $this->get_option( 'per_page', 'option' );

                 if ( ! $option )
                         $option = str_replace( '-', '_',
 "{$this->id}_per_page" );
 }}}

 In my test cases $option was loaded by the first part, meaning the hyphen
 to underscore replacement never occurred, thus the saved per_page option
 was not loaded and the default value of 20 was used instead.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19465>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list