Make WordPress Core

Changeset 52415


Ignore:
Timestamp:
12/25/2021 03:30:27 AM (3 years ago)
Author:
SergeyBiryukov
Message:

Administration: Make sure the $customize_url variable is always defined in the admin menu.

This avoids an Undefined variable PHP warning when displaying other admin menu items.

Follow-up to [52069], [52134], [52158], [52178], [52414].

Props afragen.
Fixes #54682.

File:
1 edited

Legend:

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

    r52406 r52415  
    215215}
    216216
    217 // Hide Customize link on block themes unless a plugin or theme is using
    218 // customize_register to add a setting.
     217$customize_url = add_query_arg( 'return', urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), 'customize.php' );
     218
     219// Hide Customize link on block themes unless a plugin or theme
     220// is using 'customize_register' to add a setting.
    219221if ( ! wp_is_block_theme() || has_action( 'customize_register' ) ) {
    220     $customize_url = add_query_arg( 'return', urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), 'customize.php' );
    221     $position      = wp_is_block_theme() ? 7 : 6;
     222    $position = wp_is_block_theme() ? 7 : 6;
    222223
    223224    $submenu['themes.php'][ $position ] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', 'hide-if-no-customize' );
     
    238239}
    239240
    240     unset( $customize_url );
     241unset( $customize_url );
    241242
    242243unset( $appearance_cap );
Note: See TracChangeset for help on using the changeset viewer.