do_action( 'wp_dashboard_setup' )

Fires after core widgets for the admin dashboard have been registered.


More Information More Information

This hook grants access to Dashboard-related customization options. In particular, this hook is used for adding [wp_add_dashboard_widget()] or removing[remove_meta_box()] dashboard widgets from WordPress.

To add a dashboard widget, use wp_add_dashboard_widget()

To remove a dashboard widget, use remove_meta_box()


Top ↑

Source Source

File: wp-admin/includes/dashboard.php

View on Trac



Top ↑

Changelog Changelog

Changelog
Version Description
2.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Andrija Naglic

    To remove all Dashboard widgets:

    function remove_dashboard_widgets(){
        
        global $wp_meta_boxes;
        
        foreach( $wp_meta_boxes["dashboard"] as $position => $core ){
            
            foreach( $core["core"] as $widget_id => $widget_info ){
                
                remove_meta_box( $widget_id, 'dashboard', $position );
            }
        }
        
    }
    add_action( 'wp_dashboard_setup', 'remove_dashboard_widgets', 1000000 );
  2. Skip to note 2 content
    Contributed by Collins Mbaka

    To remove a dashboard widget, call remove_meta_box() within the hooked function.

    add_action('wp_dashboard_setup', 'remove_dashboard_widgets');
    
    function remove_dashboard_widgets () {
    
          //Completely remove various dashboard widgets (remember they can also be HIDDEN from admin)
          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
    
    }
    
  3. Skip to note 3 content
    Contributed by Akira Tachibana

    Example from Codex: To Remove a Dashboard Widget

    To remove a dashboard widget, call remove_meta_box() within the hooked function.

    add_action('wp_dashboard_setup', 'remove_dashboard_widgets');
    
    function remove_dashboard_widgets () {
    
          //Completely remove various dashboard widgets (remember they can also be HIDDEN from admin)
          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
    
    }

You must log in before being able to contribute a note or feedback.