mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-06 15:47:05 +00:00
Customize: Prevent PHP notice and JS error caused by widgets and nav menus components if user only has customize capability.
Short-circuits components from initializing their hooks needlessly if current user lacks required capability. Fixes #35895. git-svn-id: https://develop.svn.wordpress.org/trunk@36611 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -23,6 +23,9 @@ class Tests_WP_Customize_Widgets extends WP_UnitTestCase {
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
require_once( ABSPATH . WPINC . '/class-wp-customize-manager.php' );
|
||||
|
||||
$user_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
|
||||
wp_set_current_user( $user_id );
|
||||
$GLOBALS['wp_customize'] = new WP_Customize_Manager();
|
||||
$this->manager = $GLOBALS['wp_customize'];
|
||||
|
||||
@@ -41,9 +44,6 @@ class Tests_WP_Customize_Widgets extends WP_UnitTestCase {
|
||||
remove_action( 'after_setup_theme', 'twentysixteen_setup' );
|
||||
remove_action( 'customize_register', 'twentysixteen_customize_register', 11 );
|
||||
|
||||
$user_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
|
||||
wp_set_current_user( $user_id );
|
||||
|
||||
$this->backup_registered_sidebars = $GLOBALS['wp_registered_sidebars'];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user