Skip to content

Commit dc24cd0

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.2 branch. Fixes #50392. git-svn-id: https://develop.svn.wordpress.org/branches/4.2@48256 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 1e6bd61 commit dc24cd0

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
@@ -405,6 +405,8 @@ function set_screen_options() {
405405
return;
406406
break;
407407
default:
408+
$screen_option = false;
409+
408410
if ( '_page' === substr( $option, -5 ) || 'layout_columns' === $option ) {
409411
/**
410412
* Filters a screen option value before it is set.
@@ -420,12 +422,12 @@ function set_screen_options() {
420422
*
421423
* @see set_screen_options()
422424
*
423-
* @param bool $keep Whether to save or skip saving the screen option value.
424-
* Default false.
425-
* @param string $option The option name.
426-
* @param int $value The number of rows to use.
425+
* @param mixed $screen_option The value to save instead of the option value.
426+
* Default false (to skip saving the current option).
427+
* @param string $option The option name.
428+
* @param int $value The option value.
427429
*/
428-
$value = apply_filters( 'set-screen-option', false, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
430+
$screen_option = apply_filters( 'set-screen-option', $screen_option, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
429431
}
430432

431433
/**
@@ -439,12 +441,12 @@ function set_screen_options() {
439441
*
440442
* @see set_screen_options()
441443
*
442-
* @param bool $keep Whether to save or skip saving the screen option value.
443-
* Default false.
444-
* @param string $option The option name.
445-
* @param int $value The number of rows to use.
444+
* @param mixed $screen_option The value to save instead of the option value.
445+
* Default false (to skip saving the current option).
446+
* @param string $option The option name.
447+
* @param int $value The option value.
446448
*/
447-
$value = apply_filters( "set_screen_option_{$option}", false, $option, $value );
449+
$value = apply_filters( "set_screen_option_{$option}", $screen_option, $option, $value );
448450

449451
if ( false === $value )
450452
return;

0 commit comments

Comments
 (0)