WordPress.org

Ready to get started?Download WordPress

Forums

Remove Recent Drafts admin dashboard widget (2 posts)

  1. aeboi80
    Member
    Posted 1 year ago #

    I'm running multi site 3.4.2 and no matter what I do I cannot programmatically remove the recent drafts widget from the admin dashboard.

    Here is the code I am using:

    //Remove dashboard widgets
    	function remove_dashboard_widgets() {
    		global $wp_meta_boxes;
    
    		unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
    		unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
    		unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
    		unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
    		unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_drafts']);
    		unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);
    		unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
    		unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
    	}
    
    	add_action('wp_dashboard_setup', 'remove_dashboard_widgets', 20 );

    All other widgets are removed, but the Recent Drafts just refuses to go away. Any thoughts?

  2. peterbrowse
    Member
    Posted 1 year ago #

    It's because it's listed under side widget not normal.

    Change the implementation from this:

    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_drafts']);

    To:

    unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']);

    and it should disappear as desired.

Topic Closed

This topic has been closed to new replies.

About this Topic