#19465 closed defect (bug) (duplicate)
'Show on screen' (per_page) options don't save for certain custom taxonomies
Reported by: | jolley_small | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.3 |
Component: | Administration | Keywords: | |
Focuses: | Cc: |
Description
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.
#18958