Skip to content

Instantly share code, notes, and snippets.

@brentini
Forked from 5A5K1A/wordpress-hooks-admin.php
Last active March 23, 2018 21:28
Show Gist options
  • Save brentini/d186281a096eef4883a39b41d8f8af0f to your computer and use it in GitHub Desktop.
Save brentini/d186281a096eef4883a39b41d8f8af0f to your computer and use it in GitHub Desktop.
WordPress Remove Dashboard sections for "simple users" #wordpress
<?php
/* Hide certain admin sections for "simple users"
/* -------------------------------------------------- */
add_action('wp_dashboard_setup', function() {
if( current_user_can('editor') ) {
remove_meta_box('dashboard_quick_press', 'dashboard', 'side'); //Quick Press widget
remove_meta_box('dashboard_recent_drafts', 'dashboard', 'side'); //Recent Drafts
remove_meta_box('dashboard_primary', 'dashboard', 'side'); //WordPress.com Blog
remove_meta_box('dashboard_secondary', 'dashboard', 'side'); //Other WordPress News
remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal'); //Incoming Links
remove_meta_box('dashboard_plugins', 'dashboard', 'normal'); //Plugins
remove_meta_box('dashboard_right_now', 'dashboard', 'normal'); //Right Now
remove_meta_box('rg_forms_dashboard', 'dashboard', 'normal'); //Gravity Forms
remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal'); //Recent Comments
remove_meta_box('icl_dashboard_widget', 'dashboard', 'normal'); //Multi Language Plugin
remove_meta_box('dashboard_activity', 'dashboard', 'normal'); //Activity
remove_action('welcome_panel', 'wp_welcome_panel');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment