add multipe sub menus using add_submenu_page

a loop is almost always a good solution to avoid to copy-paste code. you just need to use a array of datas like that : $submenus = [ [ “page_title” => “page1”, “menu_title” => “title1”, “slug” => “wp-admin.php”, ], [ “page_title” => “page2”, “menu_title” => “title2”, “slug” => “wp-login.php”, ], ]; foreach ($submenus as $value) … Read more

Sub Menu content is being duplicated

I was using the same page name for both. You can see in this snippet that I used “BCRM” and I didn’t realize it. add_submenu_page( __FILE__, ‘BCRM Customer Settings’, ‘Customer Settings’, ‘administrator’, ‘**BCRM**’, ‘bcrm_customer_settings_page’); add_submenu_page( __FILE__, ‘BCRM Form Settings’, ‘Form Settings’, ‘administrator’, ‘**BCRM**’, ‘bcrm_form_settings_page’); I changed them to BCRM_customers and BCRM_forms respectively and it is … Read more

How to add a custom taxonomy to show up in a custom post type menu?

So to answear my own question after much googeling: In the args array I commented out the option for show_in_menu, so that custom post type creates the menu itself. Then I didn’t add the admin menu, but just the submenu (the hook still remains). add_action(‘admin_menu’,’bsp_plugin_menu’); And the first parameter is the one that shows it … Read more

Admin Panel – Custom Menu Sub-Item LINK

Insert the URL of the page as the $menu_slug argument. Also note that user levels are deprecated, you should pass a capability instead. function add_custom_link() { add_submenu_page( ‘edit.php?post_type=cpt_custom’, ”, ‘Pending Posts’, ‘edit_posts’, ‘edit.php?post_type=cpt_custom&post_status=pending’, ” ); } add_action(‘admin_menu’, ‘add_custom_link’);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)