Change Dashboard menu position?

I am trying to put three menu items before the Dashboard menu item in admin dashboard. Problem is that Dashboard has menu position 2.

I can manage to put in two menu items before with position 0 and 1, but 2 collides with Dashboard.

So my thought was to move the Dashboard position. Is this possible? Can I change Dashboard menu position from 2 to something else (like 3, 4 or 5)?

Is there a hook for this?

Topic customization Wordpress

Category Web


You can reorder admin menu items like this, notice I moved index.php (dashboard) to the bottom.

function my_custom_menu_order($menu_ord) {
    if (!$menu_ord) return true;

    return array(
        'separator1', // First separator
        'edit.php', // Posts
        'upload.php', // Media
        'link-manager.php', // Links
        'edit-comments.php', // Comments
        'edit.php?post_type=page', // Pages
        'separator2', // Second separator
        'themes.php', // Appearance
        'plugins.php', // Plugins
        'users.php', // Users
        'tools.php', // Tools
        'options-general.php', // Settings
        'separator-last', // Last separator
        'index.php', // Dashboard
    );
}

add_filter( 'custom_menu_order', 'my_custom_menu_order', 10, 1 );
add_filter( 'menu_order', 'my_custom_menu_order', 10, 1 );

If you need to move menu items created manually or by a plugin you can get the correct value to add to the array by debugging like so...

function debug_admin_menu_items() {
    echo '<pre>' . print_r( $GLOBALS[ 'menu' ], TRUE) . '</pre>';
}

add_action( 'admin_init', 'debug_admin_menu_items' );

Note: The above code goes in your theme's functions.php


Go to screen Options and Install plugin Wp Admin UI Customize then you can change any thing in dashboard.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.