Make WordPress Core


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

Location:
branches/5.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.3

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

    r47959 r48245  
    680680                                break;
    681681                        default:
     682                                $screen_option = false;
     683
    682684                                if ( '_page' === substr( $option, -5 ) || 'layout_columns' === $option ) {
    683685                                        /**
     
    695697                                         * @see set_screen_options()
    696698                                         *
    697                                          * @param bool   $keep   Whether to save or skip saving the screen option value.
    698                                          *                       Default false.
    699                                          * @param string $option The option name.
    700                                          * @param int    $value  The number of rows to use.
     699                                         * @param mixed  $screen_option The value to save instead of the option value.
     700                                         *                              Default false (to skip saving the current option).
     701                                         * @param string $option        The option name.
     702                                         * @param int    $value         The option value.
    701703                                         */
    702                                         $value = apply_filters( 'set-screen-option', false, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
     704                                        $screen_option = apply_filters( 'set-screen-option', $screen_option, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    703705                                }
    704706
     
    714716                                 * @see set_screen_options()
    715717                                 *
    716                                  * @param bool   $keep   Whether to save or skip saving the screen option value.
    717                                  *                       Default false.
    718                                  * @param string $option The option name.
    719                                  * @param int    $value  The number of rows to use.
     718                                 * @param mixed   $screen_option The value to save instead of the option value.
     719                                 *                               Default false (to skip saving the current option).
     720                                 * @param string  $option        The option name.
     721                                 * @param int     $value         The option value.
    720722                                 */
    721                                 $value = apply_filters( "set_screen_option_{$option}", false, $option, $value );
     723                                $value = apply_filters( "set_screen_option_{$option}", $screen_option, $option, $value );
    722724
    723725                                if ( false === $value ) {
Note: See TracChangeset for help on using the changeset viewer.