以下是我设法编辑这些内容的一种方法的示例:
function wpse_custom_menu_order( $menu_ord ) {
if ( !$menu_ord ) return true;
return array(
\'index.php\', // Dashboard
\'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
);
}
add_filter( \'custom_menu_order\', \'wpse_custom_menu_order\', 10, 1 );
add_filter( \'menu_order\', \'wpse_custom_menu_order\', 10, 1 );
更多信息:
https://developer.wordpress.org/reference/hooks/custom_menu_order/https://developer.wordpress.org/reference/hooks/menu_order/
我发现使用这个插件是最流畅的,你也可以浏览一下代码,看看他们是如何做到的:https://wordpress.org/plugins/admin-menu-editor/. 这是一个免费的插件!