Skip to content

Instantly share code, notes, and snippets.

@DrewAPicture
Last active February 18, 2016 04:55
Show Gist options
  • Save DrewAPicture/c98e39c17437388408cd to your computer and use it in GitHub Desktop.
Save DrewAPicture/c98e39c17437388408cd to your computer and use it in GitHub Desktop.
Re-adding core menus and widgets panels back if removed via 'customizer_loaded_components' hook. Note rehooking the nav menus customize_register() method at a later priority.
<?php
require_once( ABSPATH . WPINC . '/class-wp-customize-widgets.php' );
$this->wp_customize->widgets = new WP_Customize_Widgets( $this->wp_customize );
require_once( ABSPATH . WPINC . '/class-wp-customize-nav-menus.php' );
$this->wp_customize->nav_menus = new WP_Customize_Nav_Menus( $this->wp_customize );
// Restore setup for nav menus (normally hooked at priority 11).
add_action( 'customize_register', array( $this->wp_customize->nav_menus, 'customize_register' ), 501 );
return;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment