My Question:
Is it possible to add custom dashboard widgets in the right hand column instead of only on the left hands side?

I use wp_add_dashboard_plugin( $widget_id, $widget_name, $callback, $control_callback = null ) to add the plugin code, but it doesn't have any options to allow you to set the position.

Any suggestions?

My Comments:
The Version 2.8 of WordPress suggests that it's possible, but I can't see anything in the code (/wp-admin/includes/dashboard.php) that is related to this.

It seems only to add the dashboard plugin if its name is in the $side_widgets array, the contents of which are: array('dashboard_quick_press', 'dashboard_recent_drafts', 'dashboard_primary', 'dashboard_secondary');

My thoughts are that I'd have to directly modify $wp_meta_boxes['dashboard'] - but I'm not sure of the consequences of this.

2 Answers 2


You're right - it doesn't. Neither does the wp_add_dashboard_widget function. So just use the generic add_meta_box and indicate dashboard and placement:

add_action( 'wp_dashboard_setup', 'my_dashboard_setup_function' );
function my_dashboard_setup_function() {
    add_meta_box( 'my_dashboard_widget', 'My Widget Name', 'my_dashboard_widget_function', 'dashboard', 'side', 'high' );
function my_dashboard_widget_function() {
    // widget content goes here
  • Thanks - that's great. I'd wondered whether there'd be any additional setup beyond just using add_meta_box, but it's fine.
    – Dan Smart
    Commented Dec 3, 2010 at 21:08

There currently isn't an easy API way to pre-sort the default widgets, meaning your new widget will always be at the bottom of the list.

Below is an example hooking function that will try to put your widget before the default ones. It does so by manually altering the internal array of metaboxes (of which dashboard widgets are one type) and putting your widget at the top of the list so it shows first.

function example_add_dashboard_widgets() {
    wp_add_dashboard_widget( 'example_dashboard_widget', 
        'Example Dashboard Widget', 
        'example_dashboard_widget_function' );

    // Globalize the metaboxes array, this holds all the widgets for wp-admin    
    global $wp_meta_boxes;

    // Get the regular dashboard widgets array 
    // (which has our new widget already but at the end)    
    $normal_dashboard = $wp_meta_boxes['dashboard']['normal']['core'];

    // Backup and delete our new dashbaord widget from the end of the array    
    $example_widget_backup = array( 'example_dashboard_widget' => 
        $normal_dashboard['example_dashboard_widget'] );
    unset( $normal_dashboard['example_dashboard_widget'] );

    // Merge the two arrays together so our widget is at the beginning   
    $sorted_dashboard = array_merge( $example_widget_backup, $normal_dashboard );

    // Save the sorted array back into the original metaboxes     
    $wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard;

Unfortunately this only works for people who have never re-ordered their widgets. Once a user has done so their existing preferences will override this and they will have to move your widget to the top for it to stay there.

Above content is quoted from Codex: Forcing your widget to the top

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.