Make WordPress Core

Changeset 48241


Ignore:
Timestamp:
06/30/2020 09:51:47 PM (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.

Props Chouby, sswells, SergeyBiryukov.
Fixes #50392.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/misc.php

    r48200 r48241  
    689689                                break;
    690690                        default:
     691                                $screen_option = false;
     692
    691693                                if ( '_page' === substr( $option, -5 ) || 'layout_columns' === $option ) {
    692694                                        /**
     
    704706                                         * @see set_screen_options()
    705707                                         *
    706                                          * @param bool   $keep   Whether to save or skip saving the screen option value.
    707                                          *                       Default false.
    708                                          * @param string $option The option name.
    709                                          * @param int    $value  The number of rows to use.
     708                                         * @param mixed  $screen_option The value to save instead of the option value.
     709                                         *                              Default false (to skip saving the current option).
     710                                         * @param string $option        The option name.
     711                                         * @param int    $value         The option value.
    710712                                         */
    711                                         $value = apply_filters( 'set-screen-option', false, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
     713                                        $screen_option = apply_filters( 'set-screen-option', $screen_option, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    712714                                }
    713715
     
    723725                                 * @see set_screen_options()
    724726                                 *
    725                                  * @param bool   $keep   Whether to save or skip saving the screen option value.
    726                                  *                       Default false.
    727                                  * @param string $option The option name.
    728                                  * @param int    $value  The number of rows to use.
     727                                 * @param mixed   $screen_option The value to save instead of the option value.
     728                                 *                               Default false (to skip saving the current option).
     729                                 * @param string  $option        The option name.
     730                                 * @param int     $value         The option value.
    729731                                 */
    730                                 $value = apply_filters( "set_screen_option_{$option}", false, $option, $value );
     732                                $value = apply_filters( "set_screen_option_{$option}", $screen_option, $option, $value );
    731733
    732734                                if ( false === $value ) {
Note: See TracChangeset for help on using the changeset viewer.