Unable to customize the admin menu order

2019-09-04 22:40发布

问题:

I want to customize the menu order in wordpress dashboard. I used the following code and when i insert the page of my custom plugins it doesn't make to the order. any help would be appreciated.

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

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

回答1:

 add_filter('custom_menu_order', '__return_true'); // SET CUSTOMISE MENU ORDER TRUE
    add_filter('menu_order', 'custom_menu_order');  // CUSTOMISE YOUR MENU


标签: php wordpress