Make WordPress Core

Changeset 48255


Ignore:
Timestamp:
07/01/2020 09:50:30 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 4.3 branch.
Fixes #50392.

Location:
branches/4.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.3

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

    r47982 r48255  
    414414                break;
    415415            default:
     416                $screen_option = false;
     417
    416418                if ( '_page' === substr( $option, -5 ) || 'layout_columns' === $option ) {
    417419                    /**
     
    429431                     * @see set_screen_options()
    430432                     *
    431                      * @param bool   $keep   Whether to save or skip saving the screen option value.
    432                      *                       Default false.
    433                      * @param string $option The option name.
    434                      * @param int    $value  The number of rows to use.
     433                     * @param mixed  $screen_option The value to save instead of the option value.
     434                     *                              Default false (to skip saving the current option).
     435                     * @param string $option        The option name.
     436                     * @param int    $value         The option value.
    435437                     */
    436                     $value = apply_filters( 'set-screen-option', false, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
     438                    $screen_option = apply_filters( 'set-screen-option', $screen_option, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    437439                }
    438440
     
    448450                 * @see set_screen_options()
    449451                 *
    450                  * @param bool   $keep   Whether to save or skip saving the screen option value.
    451                  *                       Default false.
    452                  * @param string $option The option name.
    453                  * @param int    $value  The number of rows to use.
     452                 * @param mixed   $screen_option The value to save instead of the option value.
     453                 *                               Default false (to skip saving the current option).
     454                 * @param string  $option        The option name.
     455                 * @param int     $value         The option value.
    454456                 */
    455                 $value = apply_filters( "set_screen_option_{$option}", false, $option, $value );
     457                $value = apply_filters( "set_screen_option_{$option}", $screen_option, $option, $value );
    456458
    457459                if ( false === $value )
Note: See TracChangeset for help on using the changeset viewer.