Make WordPress Core

Changeset 48244


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

Location:
branches/5.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.4

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

    r47957 r48244  
    687687                                break;
    688688                        default:
     689                                $screen_option = false;
     690
    689691                                if ( '_page' === substr( $option, -5 ) || 'layout_columns' === $option ) {
    690692                                        /**
     
    702704                                         * @see set_screen_options()
    703705                                         *
    704                                          * @param bool   $keep   Whether to save or skip saving the screen option value.
    705                                          *                       Default false.
    706                                          * @param string $option The option name.
    707                                          * @param int    $value  The number of rows to use.
     706                                         * @param mixed  $screen_option The value to save instead of the option value.
     707                                         *                              Default false (to skip saving the current option).
     708                                         * @param string $option        The option name.
     709                                         * @param int    $value         The option value.
    708710                                         */
    709                                         $value = apply_filters( 'set-screen-option', false, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
     711                                        $screen_option = apply_filters( 'set-screen-option', $screen_option, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    710712                                }
    711713
     
    721723                                 * @see set_screen_options()
    722724                                 *
    723                                  * @param bool   $keep   Whether to save or skip saving the screen option value.
    724                                  *                       Default false.
    725                                  * @param string $option The option name.
    726                                  * @param int    $value  The number of rows to use.
     725                                 * @param mixed   $screen_option The value to save instead of the option value.
     726                                 *                               Default false (to skip saving the current option).
     727                                 * @param string  $option        The option name.
     728                                 * @param int     $value         The option value.
    727729                                 */
    728                                 $value = apply_filters( "set_screen_option_{$option}", false, $option, $value );
     730                                $value = apply_filters( "set_screen_option_{$option}", $screen_option, $option, $value );
    729731
    730732                                if ( false === $value ) {
Note: See TracChangeset for help on using the changeset viewer.