我的函数中有一个简单的解决方案。php用于重新排序管理菜单。这是:
// Admin menu - reorder
function custom_menu_order($menu_ord){
if (!$menu_ord) return true;
return array(
\'index.php\', // Dashboard
\'edit.php?post_type=page\', // Pages
\'edit.php?post_type=shop_order\', // WooCommerce
\'edit.php?post_type=product\', // Products
\'gf_edit_forms\', // Forms
\'upload.php\', // Media
\'separator1\', // First separator
\'separator2\', // Second separator
\'separator-last\', // Last separator
\'users.php\', // Users
\'themes.php\', // Appearance
\'options-general.php\', // Settings
\'plugins.php\', // Plugins
\'tools.php\', // Tools
\'itsec\', // Security
\'edit.php?post_type=acf-field-group\', // Custom Fields
\'edit.php?post_type=cptm\' // Post types
);
}
add_filter(\'custom_menu_order\', \'custom_menu_order\');
add_filter(\'menu_order\', \'custom_menu_order\');
这很好,但这一项不起作用:\'edit.php?post_type=shop_order\', // WooCommerce
它只是出现在菜单的底部,我试图让它以正确的顺序出现的所有操作都失败了。我认为问题在于post\\u类型名称shop_order. 我认为是下划线让它失败了。有没有想过为什么会这样?请不要说使用插件是为了避免使用其他插件。非常感谢。