Make WordPress Core

Changeset 48248 for branches/5.0


Ignore:
Timestamp:
07/01/2020 09:45:52 AM (5 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.0 branch.
Fixes #50392.

Location:
branches/5.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0

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

    r47964 r48248  
    621621                break;
    622622            default:
     623                $screen_option = false;
     624
    623625                if ( '_page' === substr( $option, -5 ) || 'layout_columns' === $option ) {
    624626                    /**
     
    636638                     * @see set_screen_options()
    637639                     *
    638                      * @param bool   $keep   Whether to save or skip saving the screen option value.
    639                      *                       Default false.
    640                      * @param string $option The option name.
    641                      * @param int    $value  The number of rows to use.
     640                     * @param mixed  $screen_option The value to save instead of the option value.
     641                     *                              Default false (to skip saving the current option).
     642                     * @param string $option        The option name.
     643                     * @param int    $value         The option value.
    642644                     */
    643                     $value = apply_filters( 'set-screen-option', false, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
     645                    $screen_option = apply_filters( 'set-screen-option', $screen_option, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    644646                }
    645647
     
    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_{$option}", false, $option, $value );
     664                $value = apply_filters( "set_screen_option_{$option}", $screen_option, $option, $value );
    663665
    664666                if ( false === $value )
Note: See TracChangeset for help on using the changeset viewer.