Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function remove_menus(){
- //Find admin...
- $admin_url = get_admin_url();
- //Find php-files in admin path
- //and create an array of them
- $admin_files = array();
- foreach (glob("*.php") as $file) {
- if($file == '.' || $file == '..') continue;
- $admin_files[] = $file;
- }
- //Remove all menupages for all files in wp-admin folder
- foreach($admin_files as $af) {
- remove_menu_page( $af );
- }
- //Get all registered post types
- // types will be a list of the post type names
- $types = get_post_types();
- //Remove pages for all registered post types as well
- foreach( $types as $type ) {
- remove_menu_page( 'edit.php?post_type=' . $type);
- }
- //Get plugins and remove them from menu
- $plugins = get_plugins();
- foreach($plugins as $p) {
- remove_menu_page( strtolower($p['Name'] ) );
- }
- }
- add_action( 'admin_init', 'remove_menus' ,99);
- //Get plugins
- $plugins = get_plugins();
- foreach($plugins as $p) {
- remove_menu_page( strtolower($p['Name'] ) );
- }
- remove_menu_page('wpseo_dashboard');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement