Make WordPress Core

Changeset 48260


Ignore:
Timestamp:
07/01/2020 09:54:08 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 3.8 branch.
Fixes #50392.

Location:
branches/3.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.8

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

    r47965 r48260  
    391391                                break;
    392392                        default:
     393                                $screen_option = false;
     394
    393395                                if ( '_page' === substr( $option, -5 ) || 'layout_columns' === $option ) {
    394396                                        /**
     
    406408                                         * @see set_screen_options()
    407409                                         *
    408                                          * @param bool   $keep   Whether to save or skip saving the screen option value.
    409                                          *                       Default false.
    410                                          * @param string $option The option name.
    411                                          * @param int    $value  The number of rows to use.
     410                                         * @param mixed  $screen_option The value to save instead of the option value.
     411                                         *                              Default false (to skip saving the current option).
     412                                         * @param string $option        The option name.
     413                                         * @param int    $value         The option value.
    412414                                         */
    413                                         $value = apply_filters( 'set-screen-option', false, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
     415                                        $screen_option = apply_filters( 'set-screen-option', $screen_option, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    414416                                }
    415417
     
    425427                                 * @see set_screen_options()
    426428                                 *
    427                                  * @param bool   $keep   Whether to save or skip saving the screen option value.
    428                                  *                       Default false.
    429                                  * @param string $option The option name.
    430                                  * @param int    $value  The number of rows to use.
     429                                 * @param mixed   $screen_option The value to save instead of the option value.
     430                                 *                               Default false (to skip saving the current option).
     431                                 * @param string  $option        The option name.
     432                                 * @param int     $value         The option value.
    431433                                 */
    432                                 $value = apply_filters( "set_screen_option_{$option}", false, $option, $value );
     434                                $value = apply_filters( "set_screen_option_{$option}", $screen_option, $option, $value );
    433435
    434436                                if ( false === $value )
Note: See TracChangeset for help on using the changeset viewer.