Current class on admin menu using add_submenu_page()

Try this:

add_menu_page(__('My Plugin', 'myplugin'),__('My Plugin', 'myplugin'), 'edit_posts','my-plugin-dashboard','my_plugin_dashboard','icon');

// dashboard submenu - this fails to highlight with current
add_submenu_page('my-plugin-dashboard', __('Dashboard','myplugin'), __('Dashboard','myplugin'), 'edit_posts', 'my-plugin-dashboard', 'my_plugin_dashboard' );

// settings submenu - this fails to highlight with current
add_submenu_page('my-plugin-dashboard', __('Settings','myplugin'), __('Settings','myplugin'), 'manage_options', 'my-plugin-settings', 'my_plugin_settings' );

Essentially: don’t use full page links with admin.php?… as the page slug. Especially if you are passing callbacks, just use a slug, not a page address.

Leave a Comment

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