WordPress.org

Ready to get started?Download WordPress

Forums

Broken Link Checker
How to unset from admin dashboard widgets (4 posts)

  1. chuckingit
    Member
    Posted 3 years ago #

    Hi - i'm trying to clean up the backend for Admin Dashboard widgets so that only the admin sees the various meta boxes but no matter what i've tried, Broken Link Checker widget will not go away (see example code below) ... note i'm using WordPress 3.1 MultiSite Network and working with this code in the MU plugins folder ... not sure that matters ... i also tried Adminimize plugin but that did not work on the widget either ... thanks in advance for any pointers ... cordially, chuck scott

    /* Turn off 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']['side']['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']);
    	unset($wp_meta_boxes['dashboard']['normal']['core']['blc_dashboard_widget']);
    }
    
    if(is_admin()){
    	add_action('wp_dashboard_setup', 'remove_dashboard_widgets' );
    }
  2. Janis Elsts
    Member
    Plugin Author

    Posted 3 years ago #

    You probably need to give your callback a later priority to make it run after the plugin adds its widget. Try changing that add_action() call to this:

    add_action('wp_dashboard_setup', 'remove_dashboard_widgets', 20);

  3. chuckingit
    Member
    Posted 3 years ago #

    WOW - that totally worked - the priority setting that is ... Muchisimas Gracias WP Amigo!!!

    Long Live the WhiteShadow, his seed, friends, family, and all those like him who help bring forth code light of wisdom for the rest of us :>) cordially, chuck scott

    ps - here is the completed/corrected function and action

    /* Turn off Dashboard Widgets for everybody but Admin */
    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']['side']['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']);
    	unset($wp_meta_boxes['dashboard']['normal']['core']['blc_dashboard_widget']);
    }
    if(is_admin()){
    	add_action('wp_dashboard_setup', 'remove_dashboard_widgets', 20 );
    }
  4. Radek Kucera
    Member
    Posted 3 years ago #

    I was just looking for simiar questin :)
    This help me, thanks.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic