mirror of
git://develop.git.wordpress.org/
synced 2025-01-29 10:38:22 +01:00
Administration: Add a new filter to extend set-screen-option.
Merges [47951] to the 5.4 branch. Props: xknown, SergeyBiryukov. git-svn-id: https://develop.svn.wordpress.org/branches/5.4@47957 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
404f397b40
commit
b8dea76b49
@ -686,23 +686,46 @@ function set_screen_options() {
|
||||
}
|
||||
break;
|
||||
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.
|
||||
*
|
||||
* 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.
|
||||
* The dynamic portion of the hook, `$option`, refers to the option name.
|
||||
*
|
||||
* Returning false to the filter will skip saving the current option.
|
||||
*
|
||||
* @since 2.8.0
|
||||
* @since 5.4.2
|
||||
*
|
||||
* @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.
|
||||
* @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
|
||||
$value = apply_filters( "set_screen_option_{$option}", false, $option, $value );
|
||||
|
||||
if ( false === $value ) {
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user