From 7ac100615f606144c365a08e89d27f8d62667b3c Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 30 Jun 2020 21:53:03 +0000 Subject: [PATCH] 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. Props Chouby, sswells, SergeyBiryukov. Fixes #50392. Built from https://develop.svn.wordpress.org/trunk@48241 git-svn-id: http://core.svn.wordpress.org/trunk@48010 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/misc.php | 22 ++++++++++++---------- wp-includes/version.php | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/wp-admin/includes/misc.php b/wp-admin/includes/misc.php index 7259a6f512..6e8915b6bd 100644 --- a/wp-admin/includes/misc.php +++ b/wp-admin/includes/misc.php @@ -688,6 +688,8 @@ function set_screen_options() { } break; default: + $screen_option = false; + if ( '_page' === substr( $option, -5 ) || 'layout_columns' === $option ) { /** * Filters a screen option value before it is set. @@ -703,12 +705,12 @@ function set_screen_options() { * * @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 mixed $screen_option The value to save instead of the option value. + * Default false (to skip saving the current option). + * @param string $option The option name. + * @param int $value The option value. */ - $value = apply_filters( 'set-screen-option', false, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores + $screen_option = apply_filters( 'set-screen-option', $screen_option, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores } /** @@ -722,12 +724,12 @@ function set_screen_options() { * * @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 mixed $screen_option The value to save instead of the option value. + * Default false (to skip saving the current option). + * @param string $option The option name. + * @param int $value The option value. */ - $value = apply_filters( "set_screen_option_{$option}", false, $option, $value ); + $value = apply_filters( "set_screen_option_{$option}", $screen_option, $option, $value ); if ( false === $value ) { return; diff --git a/wp-includes/version.php b/wp-includes/version.php index 408f679558..a0ad15c09d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-alpha-48240'; +$wp_version = '5.5-alpha-48241'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.