-
Home
-
Widget Options – Advanced Conditional Visibility for Gutenberg Blocks & Classic Widgets
- Tips
How to Hide Widget Options Admin Menus
function plt_hide_widget_options_menus() {
//Hide the "Settings → Widget Options" menu.
remove_submenu_page('options-general.php', 'widgetopts_plugin_settings');
//Hide the "Settings → Widget Options Snippets" menu.
remove_submenu_page('options-general.php', 'edit.php?post_type=widgetopts_snippet');
}
add_action('admin_menu', 'plt_hide_widget_options_menus', 12);
Where do I put this code?
How to Hide Widget Options Meta Boxes
function plt_hide_widget_options_metaboxes() {
$screen = get_current_screen();
if ( !$screen ) {
return;
}
//Hide the "Snippet Code" meta box.
remove_meta_box('widgetopts_snippet_code', $screen->id, 'normal');
//Hide the "Description" meta box.
remove_meta_box('widgetopts_snippet_description', $screen->id, 'normal');
//Hide the "Help & Examples" meta box.
remove_meta_box('widgetopts_snippet_help', $screen->id, 'side');
}
add_action('add_meta_boxes', 'plt_hide_widget_options_metaboxes', 20);