Make WordPress Core


Ignore:
Timestamp:
07/01/2020 09:52:03 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 4.1 branch.
Fixes #50392.

Location:
branches/4.1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.1

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

    r47969 r48257  
    406406                                break;
    407407                        default:
     408                                $screen_option = false;
     409
    408410                                if ( '_page' === substr( $option, -5 ) || 'layout_columns' === $option ) {
    409411                                        /**
    … …  
    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
    … …  
    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 )
Note: See TracChangeset for help on using the changeset viewer.