From 668818e93da70df2425aa432794ddf6f8437f8f2 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Thu, 7 Jan 2016 06:06:28 +0000 Subject: [PATCH] Customizer: Call `_doing_it_wrong()` if `widgets` or `nav_menus` are manually removed via `WP_Customize_Manager::remove_panel()`. Advise that the `customize_loaded_components` filter should be used instead. Props voldemortensen. See #33552. Fixes #35242. Built from https://develop.svn.wordpress.org/trunk@36216 git-svn-id: http://core.svn.wordpress.org/trunk@36183 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-customize-manager.php | 12 ++++++++++++ wp-includes/version.php | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/wp-includes/class-wp-customize-manager.php b/wp-includes/class-wp-customize-manager.php index 2653247aed..e556f5ee27 100644 --- a/wp-includes/class-wp-customize-manager.php +++ b/wp-includes/class-wp-customize-manager.php @@ -1198,6 +1198,18 @@ final class WP_Customize_Manager { * @param string $id Panel ID to remove. */ public function remove_panel( $id ) { + $core_panels = array( + 'widgets', + 'nav_menus', + ); + if ( in_array( $id, $core_panels, true ) ) { + $url = 'https://core.trac.wordpress.org/ticket/33552#comment:12'; + _doing_it_wrong( + __METHOD__, + sprintf( __( 'Removing %1$s manually will cause PHP warnings. Use the customize_loaded_components filter instead. See %2$s.' ), $id, $url ), + '4.5' + ); + } unset( $this->panels[ $id ] ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 77644935f7..e4f293e578 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-alpha-36215'; +$wp_version = '4.5-alpha-36216'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.