Skip to content

Commit 181ea0f

Browse files
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. git-svn-id: https://develop.svn.wordpress.org/trunk@52415 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 9298fba commit 181ea0f

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/wp-admin/menu.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,12 @@
214214
);
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.
219221
if ( ! 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' );
224225
}
@@ -237,7 +238,7 @@
237238
$submenu['themes.php'][20] = array( __( 'Background' ), $appearance_cap, esc_url( $customize_background_url ), '', 'hide-if-no-customize' );
238239
}
239240

240-
unset( $customize_url );
241+
unset( $customize_url );
241242

242243
unset( $appearance_cap );
243244

0 commit comments

Comments
 (0)