From ef7cf47ec44dd38da1346e30e13cbdd54dc8a4da Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 25 Dec 2021 03:32:03 +0000 Subject: [PATCH] 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 --- wp-admin/menu.php | 11 ++++++----- wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/wp-admin/menu.php b/wp-admin/menu.php index 97d5f57984..5d550fb55d 100644 --- a/wp-admin/menu.php +++ b/wp-admin/menu.php @@ -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 ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 962c95d882..5aefbefcde 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.