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 乘性高斯噪声在深度学习网络中的应用
    • ¥15 运筹学排序问题中的在线排序
    • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
    • ¥30 求一段fortran代码用IVF编译运行的结果
    • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
    • ¥15 C++ 头文件/宏冲突问题解决
    • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
    • ¥50 安卓adb backup备份子用户应用数据失败
    • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
    • ¥30 python代码,帮调试,帮帮忙吧