Administration: Add a new filter to extend `set-screen-option`.
Props: xknown, SergeyBiryukov. Built from https://develop.svn.wordpress.org/trunk@47951 git-svn-id: http://core.svn.wordpress.org/trunk@47723 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ffc4869c9c
commit
dda0ccdd18
|
@ -688,23 +688,46 @@ function set_screen_options() {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
if ( '_page' === substr( $option, -5 ) || 'layout_columns' === $option ) {
|
||||||
|
/**
|
||||||
|
* Filters a screen option value before it is set.
|
||||||
|
*
|
||||||
|
* The filter can also be used to modify non-standard [items]_per_page
|
||||||
|
* settings. See the parent function for a full list of standard options.
|
||||||
|
*
|
||||||
|
* Returning false to the filter will skip saving the current option.
|
||||||
|
*
|
||||||
|
* @since 2.8.0
|
||||||
|
* @since 5.4.2 Only applied to options ending with '_page',
|
||||||
|
* or the 'layout_columns' option.
|
||||||
|
*
|
||||||
|
* @see set_screen_options()
|
||||||
|
*
|
||||||
|
* @param bool $keep Whether to save or skip saving the screen option value.
|
||||||
|
* Default false.
|
||||||
|
* @param string $option The option name.
|
||||||
|
* @param int $value The number of rows to use.
|
||||||
|
*/
|
||||||
|
$value = apply_filters( 'set-screen-option', false, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters a screen option value before it is set.
|
* Filters a screen option value before it is set.
|
||||||
*
|
*
|
||||||
* The filter can also be used to modify non-standard [items]_per_page
|
* The dynamic portion of the hook, `$option`, refers to the option name.
|
||||||
* settings. See the parent function for a full list of standard options.
|
|
||||||
*
|
*
|
||||||
* Returning false to the filter will skip saving the current option.
|
* Returning false to the filter will skip saving the current option.
|
||||||
*
|
*
|
||||||
* @since 2.8.0
|
* @since 5.4.2
|
||||||
*
|
*
|
||||||
* @see set_screen_options()
|
* @see set_screen_options()
|
||||||
*
|
*
|
||||||
* @param bool $keep Whether to save or skip saving the screen option value. Default false.
|
* @param bool $keep Whether to save or skip saving the screen option value.
|
||||||
* @param string $option The option name.
|
* Default false.
|
||||||
* @param int $value The number of rows to use.
|
* @param string $option The option name.
|
||||||
|
* @param int $value The number of rows to use.
|
||||||
*/
|
*/
|
||||||
$value = apply_filters( 'set-screen-option', false, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
|
$value = apply_filters( "set_screen_option_{$option}", false, $option, $value );
|
||||||
|
|
||||||
if ( false === $value ) {
|
if ( false === $value ) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.5-alpha-47950';
|
$wp_version = '5.5-alpha-47951';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue