Skip to content

Instantly share code, notes, and snippets.

@PatelUtkarsh
Created December 7, 2021 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PatelUtkarsh/bc591db062a4dd1829eb35e8acbcb90b to your computer and use it in GitHub Desktop.
Save PatelUtkarsh/bc591db062a4dd1829eb35e8acbcb90b to your computer and use it in GitHub Desktop.
Restore customizer
<?php
namespace utkarsh;
/**
* Restore customizer which is removed by WP Core.
*/
function restore_customizer() {
// WP version is 5.9 beta or later than only add customize.php back.
if ( ! version_compare( get_bloginfo( 'version' ), '5.9-beta', '>=' ) ) {
return;
}
// Add customize.php menu.
add_submenu_page(
'themes.php',
__( 'Customize' ),
__( 'Customize' ),
'customize',
'customize.php'
);
}
/**
* Restore customizer which is removed by gutenberg after full site editing.
*/
function restore_customizer_gutenberg() {
// Following is for gutenberg plugin, Remove action has safe check.
remove_action( 'admin_menu', 'gutenberg_remove_legacy_pages' );
}
add_action( 'init', __NAMESPACE__ . '\restore_customizer_gutenberg' );
add_action( 'admin_menu', __NAMESPACE__ . '\restore_customizer' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment