Make WordPress Core

Changeset 48259 for branches/3.9


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

Location:
branches/3.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.9

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

    r47966 r48259  
    404404                                break;
    405405                        default:
     406                                $screen_option = false;
     407
    406408                                if ( '_page' === substr( $option, -5 ) || 'layout_columns' === $option ) {
    407409                                        /**
    … …  
    419421                                         * @see set_screen_options()
    420422                                         *
    421                                          * @param bool   $keep   Whether to save or skip saving the screen option value.
    422                                          *                       Default false.
    423                                          * @param string $option The option name.
    424                                          * @param int    $value  The number of rows to use.
     423                                         * @param mixed  $screen_option The value to save instead of the option value.
     424                                         *                              Default false (to skip saving the current option).
     425                                         * @param string $option        The option name.
     426                                         * @param int    $value         The option value.
    425427                                         */
    426                                         $value = apply_filters( 'set-screen-option', false, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
     428                                        $screen_option = apply_filters( 'set-screen-option', $screen_option, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    427429                                }
    428430
    … …  
    438440                                 * @see set_screen_options()
    439441                                 *
    440                                  * @param bool   $keep   Whether to save or skip saving the screen option value.
    441                                  *                       Default false.
    442                                  * @param string $option The option name.
    443                                  * @param int    $value  The number of rows to use.
     442                                 * @param mixed   $screen_option The value to save instead of the option value.
     443                                 *                               Default false (to skip saving the current option).
     444                                 * @param string  $option        The option name.
     445                                 * @param int     $value         The option value.
    444446                                 */
    445                                 $value = apply_filters( "set_screen_option_{$option}", false, $option, $value );
     447                                $value = apply_filters( "set_screen_option_{$option}", $screen_option, $option, $value );
    446448
    447449                                if ( false === $value )
Note: See TracChangeset for help on using the changeset viewer.