-
Home
-
Simple Custom CSS and JS
- Tips
How to Hide Simple Custom CSS and JS Admin Menus
function plt_hide_custom_css_js_menus() {
//Hide "Custom CSS JS".
remove_menu_page('edit.php?post_type=custom-css-js');
//Hide "Custom CSS JS → All Custom Code".
remove_submenu_page('edit.php?post_type=custom-css-js', 'edit.php?post_type=custom-css-js');
//Hide "Custom CSS JS → Add Custom CSS".
remove_submenu_page('edit.php?post_type=custom-css-js', 'post-new.php?post_type=custom-css-js&language=css');
//Hide "Custom CSS JS → Add Custom JS".
remove_submenu_page('edit.php?post_type=custom-css-js', 'post-new.php?post_type=custom-css-js&language=js');
//Hide "Custom CSS JS → Add Custom HTML".
remove_submenu_page('edit.php?post_type=custom-css-js', 'post-new.php?post_type=custom-css-js&language=html');
//Hide "Custom CSS JS → Settings".
remove_submenu_page('edit.php?post_type=custom-css-js', 'custom-css-js-config');
}
add_action('admin_menu', 'plt_hide_custom_css_js_menus', 11);
Where do I put this code?
How to Hide Simple Custom CSS and JS Meta Boxes
function plt_hide_custom_css_js_metaboxes() {
$screen = get_current_screen();
if ( !$screen ) {
return;
}
//Hide the "Options" meta box.
remove_meta_box('custom-code-options', $screen->id, 'side');
//Hide the "Preview" meta box.
remove_meta_box('previewdiv', $screen->id, 'normal');
//Hide the "Apply only on these URLs" meta box.
remove_meta_box('url-rules', $screen->id, 'normal');
//Hide the "Code Revisions" meta box.
remove_meta_box('revisionsdiv', $screen->id, 'normal');
}
add_action('add_meta_boxes', 'plt_hide_custom_css_js_metaboxes', 20);