Make WordPress Core


Ignore:
Timestamp:
07/01/2020 09:49:28 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.5 branch.
Fixes #50392.

Location:
branches/4.5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.5

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

    r47973 r48253  
    437437                                break;
    438438                        default:
     439                                $screen_option = false;
     440
    439441                                if ( '_page' === substr( $option, -5 ) || 'layout_columns' === $option ) {
    440442                                        /**
     
    452454                                         * @see set_screen_options()
    453455                                         *
    454                                          * @param bool   $keep   Whether to save or skip saving the screen option value.
    455                                          *                       Default false.
    456                                          * @param string $option The option name.
    457                                          * @param int    $value  The number of rows to use.
     456                                         * @param mixed  $screen_option The value to save instead of the option value.
     457                                         *                              Default false (to skip saving the current option).
     458                                         * @param string $option        The option name.
     459                                         * @param int    $value         The option value.
    458460                                         */
    459                                         $value = apply_filters( 'set-screen-option', false, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
     461                                        $screen_option = apply_filters( 'set-screen-option', $screen_option, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    460462                                }
    461463
     
    471473                                 * @see set_screen_options()
    472474                                 *
    473                                  * @param bool   $keep   Whether to save or skip saving the screen option value.
    474                                  *                       Default false.
    475                                  * @param string $option The option name.
    476                                  * @param int    $value  The number of rows to use.
     475                                 * @param mixed   $screen_option The value to save instead of the option value.
     476                                 *                               Default false (to skip saving the current option).
     477                                 * @param string  $option        The option name.
     478                                 * @param int     $value         The option value.
    477479                                 */
    478                                 $value = apply_filters( "set_screen_option_{$option}", false, $option, $value );
     480                                $value = apply_filters( "set_screen_option_{$option}", $screen_option, $option, $value );
    479481
    480482                                if ( false === $value )
Note: See TracChangeset for help on using the changeset viewer.