Home › Forums › Add-ons › Options Page › Options Page WP Admin Menu Order
Does anyone have a proven method to change the position of the Options Page in the WordPress Admin menu? No matter what I do it doesn’t budge. Any help is greatly appreciated.
This is where I am at now…using these two functions to create Options Page and then re-order the menu items:
if( function_exists('acf_add_options_page')) {
acf_add_options_page(array('page_title'=>'Theme Options','menu_title'=>'Theme Options','menu_slug'=>'theme-options','capability'=>'edit_posts','redirect'=>true));
acf_add_options_sub_page(array('page_title'=>'Site Settings','menu_title'=>'Site Settings','parent_slug'=>'theme-options'));
acf_add_options_sub_page(array('page_title'=>'Header Area','menu_title'=>'Header Area','parent_slug'=>'theme-options'));
acf_add_options_sub_page(array('page_title'=>'Promo Area','menu_title'=>'Promo Area','parent_slug'=>'theme-options'));
acf_add_options_sub_page(array('page_title'=>'Footer Area','menu_title'=>'Footer Area','parent_slug'=>'theme-options'));
}
function custom_menu_order($menu_ord) {
if (!$menu_ord) return true;
return array(
'index.php', // Dashboard
'upload.php', // Media
'edit.php', // Posts
'edit.php?post_type=page', // Pages
'edit.php?post_type=books', // Books
'edit.php?post_type=webinars', // Webinars
'edit.php?post_type=acf-field-group', // Field Groups
'admin.php?page=acf-options-site-settings', // Theme Options
'edit-comments.php', // Comments
'themes.php', // Appearance
'plugins.php', // Plugins
'users.php', // Users
'tools.php', // Tools
'options-general.php', // Settings
'admin.php?page=site-migration-export', // Migration
);
}
add_filter('custom_menu_order', 'custom_menu_order');
add_filter('menu_order', 'custom_menu_order');
You should be able to use the position
option in the acf_add_options_page()
function. This page should give you more idea about it: https://www.advancedcustomfields.com/resources/acf_add_options_page/. So it should be like this:
acf_add_options_page(array(
'page_title'=>'Theme Options',
'menu_title'=>'Theme Options',
'menu_slug'=>'theme-options',
'capability'=>'edit_posts',
'redirect'=>true,
'position' => '63.3' // use decimal instead of integer to avoid conflict
));
I hope this helps 🙂
I tried position a lot with integers to no effect however I didn’t try decimals. Anyways, I think I found a better solution…thank you for the input though, it is appreciated.
I ended up going with a plugin, even though I always prefer to hard code something myself when possible. This case just seemed too wonky to rely on hand coding it.
For those looking an easy solution, this plugin worked great out of the box and took less than two minutes to learn and configure:
https://wordpress.org/plugins/admin-menu-editor/
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
Accordions are a great way to group related information while allowing users to interactively show and hide content. In this video, Damon Cook goes in-depth on how to create an accessible accordion block using ACF PRO’s Repeater field.https://t.co/RXT0g25akN
— Advanced Custom Fields (@wp_acf) March 2, 2023
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.