Highlighting admin submenu pages

Try it: function sunshine_submenu_show_fix($parent_file) { global $plugin_page; $taxonomy = $current_screen->taxonomy; if ($taxonomy == ‘sunshine-product-category’) $plugin_page=”sunshine_admin”; return $parent_file; } add_action(‘parent_file’, ‘sunshine_submenu_show_fix’); explanation: in file /wp-admin/menu-header.php: $parent_file = apply_filters( ‘parent_file’, $parent_file ); get_admin_page_parent(); … function _wp_menu_output(…) { … if ( ( $parent_file && $item[2] == $parent_file ) || ( empty($typenow) && $self == $item[2] ) ) { … Read more

Include script files for admin submenu page

You must have created submenu page using add_submenu_page() hook, so you can use wp_enqueue_script inside callback function of add_submenu_page hook. It will load script only on your submenu page. add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug,’callback’); function callback() { //enqueue script } Or if you want to enqueue script in dashboard(all pages) then you can enqueue … Read more

sub-page settings saving in NETWORK DASHBOARD

The easiest thing to do is to set the form’s action=” and use the global $plugin_page; as described in the Notes section of add_submenu_page(). For example: add_action (‘network_admin_menu’, ‘add_network_menus’) ; function add_network_menus () { add_menu_page (‘My Page Title’, ‘My Menu Title’, ‘manage_network’, ‘my_menu_slug’, ‘my_network_admin_page’) ; add_submenu_page (‘my_menu_slug’, ‘Some Subpage Title’, ‘My Submeny Title’, ‘manage_network’, ‘my_submenu_slug’, … Read more

add submenu page doesn’t display

The fourth parameter in add_submenu_page function is a capability. Try changing it to manage_options so your code looks like this: add_submenu_page(‘tictac_admin_menu’, ‘Sous menu Opening’, ‘Options Opening’, ‘manage_options’, ‘tictac_scripts_menu’, ‘tictac_opening_submenu’ ); Hope it helps

WordPress add page under admin submenu and retaining the active status of the parent submenu page in the menu

If I understand it correctly — you want the “Plans” sub-menu to be highlighted when on the “Add/edit plans” (pxmag-plans-edit) page, then you can do it like so: Use the add_menu_classes hook to highlight the pxmag-menu menu: function my_add_menu_classes( $menu ) { // Do nothing if not on the “Add/edit plans” page. global $plugin_page; if … Read more

Visiting a console submenu page does not expand its parent menu item

You can use the parent_file hook to ensure the TDLRM menu is expanded when viewing the “Store users” or “Categories” page. add_filter( ‘parent_file’, ‘wpse_398962_parent_file’ ); function wpse_398962_parent_file( $parent_file ) { global $submenu_file, $typenow; // 1: This is for highlighting the TDLRM » “Store users” submenu. if ( ‘users.php’ === $parent_file && ! $submenu_file && isset( … Read more

add_submenu_page() issue

edit.php?post_type=weather isn’t a valid PHP function name. If you’re trying to set the menu up as a submenu of your custom post screens, I think edit.php?post_type=weather—the $parent_slug—should be the first parameter, not the last. ie, add_submenu_page( ‘edit.php?post_type=weather’, ‘Weather Information’, ‘Weathers’, ‘manage_options’, ‘weathers’, [$this, ‘weathers’] ); References add_submenu_page()

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