Check if add_menu_page exists or not

You can use the fourth parameter of add_menu_page(), the my_unique_slug, to check if the page exists: if ( empty ( $GLOBALS[‘admin_page_hooks’][‘my_unique_slug’] ) ) add_menu_page( ‘Page Title’, ‘Top Menu Title’, ‘manage_options’, ‘my_unique_slug’, ‘my_magic_function’ ); $GLOBALS[‘admin_page_hooks’] is the list of registered pages.

How to Add a Sub Menu Page to a Custom Post Type?

add_options_page() automatically adds it underneath settings, however add_submenu_page() gives you control as to where you want it to show up. Try something like this: add_submenu_page( ‘edit.php?post_type=portfolios’, __( ‘Test Settings’, ‘menu-test’ ), __( ‘Test Settings’, ‘menu-test’ ), ‘manage_options’, ‘testsettings’, ‘mt_settings_page’ );

add_menu_page() with different name for first submenu item

You can make the ‘slug’ for the submenu page equal that of the top level page, and they’ll point to the same place: add_action(‘admin_menu’, ‘my_menu_pages’); function my_menu_pages(){ add_menu_page(‘My Page Title’, ‘My Menu Title’, ‘manage_options’, ‘my-menu’, ‘my_menu_output’ ); add_submenu_page(‘my-menu’, ‘Submenu Page Title’, ‘Whatever You Want’, ‘manage_options’, ‘my-menu’ ); add_submenu_page(‘my-menu’, ‘Submenu Page Title2’, ‘Whatever You Want2’, ‘manage_options’, … Read more

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