doulongsi1831 2019-03-08 09:23
浏览 36

整理Wordpress管理菜单

I am trying to implement the solution provided by the correct answer to this Question:

https://wordpress.stackexchange.com/a/276249/111198

I have a LOT of plugins, and CPT's going on, as well as Avada theme installed. I'm running the latest version of everything:

I've first built out the array exactly as the menu appears in my admin panel:

//Rearrange the admin section
function wpse_custom_menu_order( $menu_ord ) {
if (!$menu_ord) return true;
return array(
    'index.php', // Dashboard
    'activity_log_page', //Activity Log
    'avada', //Avada
    'fusion-builder-options', //Fusion Builder Options
    'edit.php?post_type=slide', //Fusion Slider Post Type
    'separator1', // First separator
    'edit.php', // Posts
    'edit.php?post_type=eguide_article', //eGUIDE Articles CPT
    'edit.php?post_type=webinars', //Webinars CPT
    'edit.php?post_type=tribe_events', //Tribe Events
    'edit.php?post_type=vendors', //Products & Services Directory
    'upload.php', // Media
    'edit.php?post_type=associations', //Associations & Organizations Directory
    'quick-featured-images-overview', //Featured Images Plugin
    'edit.php?post_type=tradeshows', //Tradeshows Directory
    'edit.php?post_type=institutions', //Institutions Directory
    'edit.php?post_type=agencies', //Agencies Directory
    'edit.php?post_type=professionals', // Professionals Directory
    'gf_edit_forms', // Gravity Forms Plugin
    'edit.php?post_type=page', // Pages
    'edit-comments.php', // Comments
    'edit.php?post_type=bp-email', //BuddyPress Emails Plugin
    'edit.php?post_type=avada_portfolio', //Portfolio Avada
    'edit.php?post_type=avada_faq', //FAQ Avada
    'separator2', // Second separator
    'themes.php', // Appearance
    'buddyboss-updater', //BuddyBoss Updater
    'plugins.php', // Plugins
    'users.php', // Users
    'tools.php', // Tools
    'options-general.php', // Settings
    'edit.php?post_type=acf-field-group', //Advanced Custom Fields Plugin
    'separator3', // Third separator
    'wpseo_dashboard', //Yoast SEO
    'edit.php?post_type=themefusion_elastic', //Elastic Slider
    'seed_csp4', //Coming Soon SeedProd
    'bp-general-settings', //BuddyPress General
    'layerslider', //LayerSlider
    'bsa-pro-sub-menu', //Ads Pro
    'cptui_manage_post_types', //CPT UI
    'separator4', //Fourth separator
    'edit.php?post_type=mp-reminder', //MemberPress
    'real3d_flipbook_admin', //Flipbook Plugin
    'revslider', //Revslider
    'bp-activity', //Buddypress Activity
    'bp-groups', //Buddypress Groups
    'separator-last' // Last separator
    );
}
add_filter( 'custom_menu_order', '__return_true' );
add_filter( 'menu_order', 'wpse_custom_menu_order', 10, 1 );

I want to rearrange the entire array, however as a test, I simply moved the Posts 'edit.php' to the bottom to make sure everything was working:

//Rearrange the admin section
function wpse_custom_menu_order( $menu_ord ) {
if (!$menu_ord) return true;
return array(
    'index.php', // Dashboard
    'activity_log_page', //Activity Log
    'avada', //Avada
    'fusion-builder-options', //Fusion Builder Options
    'edit.php?post_type=slide', //Fusion Slider Post Type
    'separator1', // First separator
    //Posts moved from here...
    'edit.php?post_type=eguide_article', //eGUIDE Articles CPT
    'edit.php?post_type=webinars', //Webinars CPT
    'edit.php?post_type=tribe_events', //Tribe Events
    'edit.php?post_type=vendors', //Products & Services Directory
    'upload.php', // Media
    'edit.php?post_type=associations', //Associations & Organizations Directory
    'quick-featured-images-overview', //Featured Images Plugin
    'edit.php?post_type=tradeshows', //Tradeshows Directory
    'edit.php?post_type=institutions', //Institutions Directory
    'edit.php?post_type=agencies', //Agencies Directory
    'edit.php?post_type=professionals', // Professionals Directory
    'gf_edit_forms', // Gravity Forms Plugin
    'edit.php?post_type=page', // Pages
    'edit-comments.php', // Comments
    'edit.php?post_type=bp-email', //BuddyPress Emails Plugin
    'edit.php?post_type=avada_portfolio', //Portfolio Avada
    'edit.php?post_type=avada_faq', //FAQ Avada
    'separator2', // Second separator
    'themes.php', // Appearance
    'buddyboss-updater', //BuddyBoss Updater
    'plugins.php', // Plugins
    'users.php', // Users
    'tools.php', // Tools
    'options-general.php', // Settings
    'edit.php?post_type=acf-field-group', //Advanced Custom Fields Plugin
    'separator3', // Third separator
    'wpseo_dashboard', //Yoast SEO
    'edit.php?post_type=themefusion_elastic', //Elastic Slider
    'seed_csp4', //Coming Soon SeedProd
    'bp-general-settings', //BuddyPress General
    'layerslider', //LayerSlider
    'bsa-pro-sub-menu', //Ads Pro
    'cptui_manage_post_types', //CPT UI
    'separator4', //Fourth separator
    'edit.php?post_type=mp-reminder', //MemberPress
    'real3d_flipbook_admin', //Flipbook Plugin
    'revslider', //Revslider
    'bp-activity', //Buddypress Activity
    'bp-groups', //Buddypress Groups
    'separator-last', // Last separator
    'edit.php' // Posts MOVED HERE
    );
}
add_filter( 'custom_menu_order', 'wpse_custom_menu_order', 10, 1 );
add_filter( 'menu_order', 'wpse_custom_menu_order', 10, 1 );

Reloaded the admin...nothing has moved. No errors, no issues - just nothing happens. I even tried changing the custom_menu_order filter to the one provided in the Wordpress Code Reference:

add_filter( 'custom_menu_order', '__return_true' );

But no change. What am I doing wrong?

P.S: I know there is a plugin that does this, but I have more than enough plugins running already, and would rather hard-code this if possible!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
    • ¥20 软件测试决策法疑问求解答
    • ¥15 win11 23H2删除推荐的项目,支持注册表等
    • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
    • ¥15 qt6.6.3 基于百度云的语音识别 不会改
    • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
    • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
    • ¥15 lingo18勾选global solver求解使用的算法
    • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
    • ¥20 测距传感器数据手册i2c