Make WordPress Core

Changeset 48247


Ignore:
Timestamp:
07/01/2020 09:45:25 AM (6 years ago)
Author:
SergeyBiryukov
Message:

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 5.1 branch.
Fixes #50392.

Location:
branches/5.1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.1

  • branches/5.1/src/wp-admin/includes/misc.php

    r47963 r48247  
    640640                                break;
    641641                        default:
     642                                $screen_option = false;
     643
    642644                                if ( '_page' === substr( $option, -5 ) || 'layout_columns' === $option ) {
    643645                                        /**
     
    655657                                         * @see set_screen_options()
    656658                                         *
    657                                          * @param bool   $keep   Whether to save or skip saving the screen option value.
    658                                          *                       Default false.
    659                                          * @param string $option The option name.
    660                                          * @param int    $value  The number of rows to use.
     659                                         * @param mixed  $screen_option The value to save instead of the option value.
     660                                         *                              Default false (to skip saving the current option).
     661                                         * @param string $option        The option name.
     662                                         * @param int    $value         The option value.
    661663                                         */
    662                                         $value = apply_filters( 'set-screen-option', false, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
     664                                        $screen_option = apply_filters( 'set-screen-option', $screen_option, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    663665                                }
    664666
     
    674676                                 * @see set_screen_options()
    675677                                 *
    676                                  * @param bool   $keep   Whether to save or skip saving the screen option value.
    677                                  *                       Default false.
    678                                  * @param string $option The option name.
    679                                  * @param int    $value  The number of rows to use.
     678                                 * @param mixed   $screen_option The value to save instead of the option value.
     679                                 *                               Default false (to skip saving the current option).
     680                                 * @param string  $option        The option name.
     681                                 * @param int     $value         The option value.
    680682                                 */
    681                                 $value = apply_filters( "set_screen_option_{$option}", false, $option, $value );
     683                                $value = apply_filters( "set_screen_option_{$option}", $screen_option, $option, $value );
    682684
    683685                                if ( false === $value ) {
Note: See TracChangeset for help on using the changeset viewer.