Skip to content

Commit 87ed444

Browse files
Administration: Pass the result of set-screen-option filter to the new set_screen_option_{$option} filter to ensure backward compatibility.
Rename the `$keep` parameter of both filters to `$screen_option` for clarity, update the documentation to better reflect its purpose. Follow-up to [47951]. Props Chouby, sswells, SergeyBiryukov. Merges [48241] to the 4.5 branch. Fixes #50392. git-svn-id: https://develop.svn.wordpress.org/branches/4.5@48253 602fd350-edb4-49c9-b593-d223f7449a82
1 parent d2c2699 commit 87ed444

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

src/wp-admin/includes/misc.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,8 @@ function set_screen_options() {
436436
return;
437437
break;
438438
default:
439+
$screen_option = false;
440+
439441
if ( '_page' === substr( $option, -5 ) || 'layout_columns' === $option ) {
440442
/**
441443
* Filters a screen option value before it is set.
@@ -451,12 +453,12 @@ function set_screen_options() {
451453
*
452454
* @see set_screen_options()
453455
*
454-
* @param bool $keep Whether to save or skip saving the screen option value.
455-
* Default false.
456-
* @param string $option The option name.
457-
* @param int $value The number of rows to use.
456+
* @param mixed $screen_option The value to save instead of the option value.
457+
* Default false (to skip saving the current option).
458+
* @param string $option The option name.
459+
* @param int $value The option value.
458460
*/
459-
$value = apply_filters( 'set-screen-option', false, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
461+
$screen_option = apply_filters( 'set-screen-option', $screen_option, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
460462
}
461463

462464
/**
@@ -470,12 +472,12 @@ function set_screen_options() {
470472
*
471473
* @see set_screen_options()
472474
*
473-
* @param bool $keep Whether to save or skip saving the screen option value.
474-
* Default false.
475-
* @param string $option The option name.
476-
* @param int $value The number of rows to use.
475+
* @param mixed $screen_option The value to save instead of the option value.
476+
* Default false (to skip saving the current option).
477+
* @param string $option The option name.
478+
* @param int $value The option value.
477479
*/
478-
$value = apply_filters( "set_screen_option_{$option}", false, $option, $value );
480+
$value = apply_filters( "set_screen_option_{$option}", $screen_option, $option, $value );
479481

480482
if ( false === $value )
481483
return;

0 commit comments

Comments
 (0)