Created
December 7, 2021 14:41
-
-
Save PatelUtkarsh/bc591db062a4dd1829eb35e8acbcb90b to your computer and use it in GitHub Desktop.
Restore customizer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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