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.
Built from https://develop.svn.wordpress.org/trunk@52415


git-svn-id: http://core.svn.wordpress.org/trunk@52007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-12-25 03:32:03 +00:00
parent 7996e87f38
commit ef7cf47ec4
2 changed files with 7 additions and 6 deletions

View File

@ -214,11 +214,12 @@ if ( wp_is_block_theme() ) {
);
}
// Hide Customize link on block themes unless a plugin or theme is using
// customize_register to add a setting.
$customize_url = add_query_arg( 'return', urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), 'customize.php' );
// Hide Customize link on block themes unless a plugin or theme
// is using 'customize_register' to add a setting.
if ( ! wp_is_block_theme() || has_action( 'customize_register' ) ) {
$customize_url = add_query_arg( 'return', urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), 'customize.php' );
$position = wp_is_block_theme() ? 7 : 6;
$position = wp_is_block_theme() ? 7 : 6;
$submenu['themes.php'][ $position ] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', 'hide-if-no-customize' );
}
@ -237,7 +238,7 @@ if ( current_theme_supports( 'custom-background' ) && current_user_can( 'customi
$submenu['themes.php'][20] = array( __( 'Background' ), $appearance_cap, esc_url( $customize_background_url ), '', 'hide-if-no-customize' );
}
unset( $customize_url );
unset( $customize_url );
unset( $appearance_cap );

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.9-beta4-52414';
$wp_version = '5.9-beta4-52415';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.