Make WordPress Core


Ignore:
Timestamp:
02/20/2021 09:53:48 AM (4 years ago)
Author:
SergeyBiryukov
Message:

Script Loader: Explicitly declare the $pagenow global in wp_deregister_script().

This avoids an "Undefined index" PHP notice in wp_resource_hints() tests when running the full test suite.

Remove the unused global from get_home_url().

Follow-up to [25443], [38100], [38174], [50156], [50164].

Props peterwilsoncc.
Fixes #52566.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.wp-scripts.php

    r49758 r50393  
    259259 * @since 2.1.0
    260260 *
     261 * @global string $pagenow
     262 *
    261263 * @param string $handle Name of the script to be removed.
    262264 */
    263265function wp_deregister_script( $handle ) {
     266    global $pagenow;
     267
    264268    _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
    265269
     
    270274    $current_filter = current_filter();
    271275    if ( ( is_admin() && 'admin_enqueue_scripts' !== $current_filter ) ||
    272         ( 'wp-login.php' === $GLOBALS['pagenow'] && 'login_enqueue_scripts' !== $current_filter )
     276        ( 'wp-login.php' === $pagenow && 'login_enqueue_scripts' !== $current_filter )
    273277    ) {
    274278        $not_allowed = array(
Note: See TracChangeset for help on using the changeset viewer.