Admin Menus – Name Menu different from first Submenu [duplicate]

This question already has answers here: add_menu_page() with different name for first submenu item (5 answers) Closed 9 years ago. I am creating a submenu with the following code: add_action( ‘admin_menu’, ‘jp_create_admin_pages’ ); function jp_create_admin_pages() { add_menu_page( ‘Members’, ‘Members’, ‘manage_options’, ‘members’, ‘jp_handle_admin_members’); add_submenu_page( ‘members’, ‘Membership Types’, ‘Membership Types’, ‘manage_options’, ‘jp_handle_admin_membership_types’); } This creates a custom … Read more

How to prevent parent admin page from appearring as a child admin page

I am using this code: add_menu_page($page_title, $menu_title, $this->capability, $menu_slug, $function); Which is adding top level admin page. When I add: add_submenu_page( $menu_slug, ‘sub menu 1’, ‘sub menu 1’, $this->capability, $menu_slug . ‘_sub_menu_page_1’, $function ); I get not only the desired child page, but also the parent page moves to become a child page of itself. … Read more

How to change menu page capability

Is it possible to change the capability set for a menu page, previously added with add_menu_page()? I have a third plugin installed, that set a menu page created with a ‘manage_options’ capability, and severals submenus with the same capability: add_menu_page( $title, __( ‘Menu Example’,’menu-example’ ), ‘manage_options’, $page, null , $icon_url ); add_submenu_page( $parent, $title1, $title1, … Read more

Add highlighting to new Admin Dashboard Menu Item

I have implemented a Custom menu item in my wordpress dashboard using the following command in the functions.php function create_menu() { $settings_page = add_menu_page(‘Edit_Post_69’, ‘Edit_Post_69’, ‘add_users’, ‘/post.php?post=69&action=edit’, ”, get_stylesheet_directory_uri() . ‘/editicon.png’, 2); } This works great and has added the icon into the dashmenu, included the icon and when clicked, takes me to the Edit … Read more

Generate Advanced Custom Fields box in custom admin menu page

I have created an custom admin menu page called FCC Youtube with add_menu_page function which has some custom fields I manually generated via HTML and PHP: code ( just the part how I created this custom admin menu page ) // creat admin menu page add_action(“admin_menu”,”youtube_menu”); function youtube_menu() { add_menu_page(‘Youtube Channel Settings’, ‘FCC Youtube’, ‘edit_pages’, … Read more

The seventh parameter passed to add_submenu_page()

I’m testing WordPress 5.3 (5.3-RC4-46673) with my theme. I have WP_DEBUG enabled. I notice the following error in the dashboard now: Notice: add_submenu_page was called incorrectly. The seventh parameter passed to add_submenu_page() should be an integer representing menu position. Please see Debugging in WordPress for more information. (This message was added in version 5.3.0.) in … Read more

Adding an admin page – OOP approach not working

I have a parent class, which contains the following: use app\My_Dashboard; class My_Class { public function __construct() { add_action(‘admin_menu’, array($this, ‘setup_dashboard_page’)); } public function setup_dashboard_page() { My_Dashboard::add_dashboard_page(); } } And the class which has the admin page functions: class My_Dashboard { public static function add_dashboard_page() { add_menu_page(‘My Settings’, ‘My Settings’, ‘my-settings’, array($this, ‘dashboard_page_cb’)); } public … Read more

What is the use of $page_title and how to use it?

I’m developing a WordPress plugin and added add_menu_page() but not sure what is the use of first parameter $page_title. If this is to use to display page title on the plugin page then how can I do that? <?php add_menu_page($page_title, $menu_title, $capability, $menu_slug); ?> I have also gone through WordPress codex for this function but … Read more