WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created a custom dashboard page to which the user is redirected when logged in. I want to include the 'Right Now' widget to my custom dashboard page. How do I achieve that ?

class CustomDash {

function __construct(){

    add_action( 'admin_menu', array( &$this, 'nn_register_custom_dash' ) );
    add_action( 'load-index.php', array( &$this, 'nn_redirect_custom_dash' ) );

function nn_register_custom_dash(){

    add_dashboard_page( 'Custom Dash', 'Custom Dash', 'manage_options', 'custom-dash', array( &$this, 'nn_create_dash' ) );

function nn_redirect_custom_dash(){

    $screen = get_current_screen();
    if( $screen->base == 'dashboard' )
        wp_redirect( admin_url( 'index.php?page=custom-dash' ) );

function nn_create_dash(){


new CustomDash();
share|improve this question
Do you call wp_dashboard() in your custom page? – toscho Oct 14 '13 at 10:34
Nope ! Is it deprecated ? Could not find it on codex ! – Navin Nagpal Oct 14 '13 at 10:52
Show us what you did and how you did it -> in Code. – kaiser Oct 14 '13 at 11:16
My bad. Edited for better clarity ! – Navin Nagpal Oct 14 '13 at 11:19
Take a look at how it's implemented in core: core.trac.wordpress.org/browser/tags/3.6.1/wp-admin/includes/…. Also take a look at codex.wordpress.org/Function_Reference/wp_add_dashboard_widget if you haven't already. You may need to look into duplicating the widget for re-use in your page if you can't call it directly. – morganestes Oct 14 '13 at 20:41

I've got to know it in Make WordPress UI. The plugin Dashboard uses a very interesting technique:

add_action( 'load-index.php', array( $this , 'override_dashboard' ) );

public function override_dashboard() 
    if( !isset( $_GET['page'] || 'custom-dash' != $_GET['page'] )

    if ( get_current_screen()->in_admin( 'site' ) ) {
        require dirname( __FILE__ ) . '/dashboard-override.php';

And then it proceeds to fully rebuild the Dashboard with the file dashboard-override.php, with a brand new clones of the Widgets, like rightnow.php. I think it's worth emulating.

share|improve this answer
Thanx a lot. Will try to implement and let you know the results! – Navin Nagpal Oct 15 '13 at 3:40
Hi @brasofilo this works well for custom dashboard page wherein the URL remains the same i.e. index.php. But not in the case where a dashboard page has been added and URL for dashboard now is 'index.php?page=custom-dash' (as posted in the code above) – Navin Nagpal Oct 15 '13 at 19:34
Try with the edited code. I'm not sure about get_current_screen(), test if it's the correct check. – brasofilo Oct 15 '13 at 19:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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