WordPress.org

Forums

Programatically remove the WordPress News Widget from the dashboard (6 posts)

  1. robahas
    Member
    Posted 1 year ago #

    Hi all - I'm customizing my dashboard and have used the codex instructions successfully. However, my WordPress News meta box stubbornly refuses to go away! It's ID is set to 'dashboard_primary' and according to the instructions I have this in my function:

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

    But it's still there. Any idea why?

    Thanks!

  2. Instead of unsetting a global variable I would just use the remove_meta_box function() instead. Here is how I remove all the dashboard widgets.

    function remove_dashboard_meta() {
            remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
            remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' );
            remove_meta_box( 'dashboard_primary', 'dashboard', 'normal' );
            remove_meta_box( 'dashboard_secondary', 'dashboard', 'normal' );
            remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
            remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' );
            remove_meta_box( 'dashboard_recent_drafts', 'dashboard', 'side' );
            remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );
            remove_meta_box( 'dashboard_right_now', 'dashboard', 'normal' );
    }
    add_action( 'admin_init', 'remove_dashboard_meta' );
  3. robahas
    Member
    Posted 1 year ago #

    Thanks Chris - Worked great.

  4. Arsalan Chishti
    Blocked
    Posted 1 year ago #

    where will i use the code.>? in the theme functions ? please help me

  5. nickohrn
    Member
    Posted 1 year ago #

    **chhelp** - You can put this code in the your theme's functions.php and it should work fine.

  6. Arsalan Chishti
    Blocked
    Posted 1 year ago #

    Nickohrn

    Thank You Very Much For Haeling Me Out !!

Topic Closed

This topic has been closed to new replies.

About this Topic