Home > AI > Backend > Wordpress >

wp_dashboard_setup

Example:

/**
 * For dashboard widgets for non-admins
 */
function st_remove_dashboard_widgets(){
    if( !current_user_can('administrator')) {
        remove_meta_box('dashboard_activity', 'dashboard', 'normal'); // remove activities
        remove_meta_box('dashboard_primary', 'dashboard', 'side');   // WordPress blog
    }
}
add_action('wp_dashboard_setup', 'st_remove_dashboard_widgets');

Leave a Reply