One important use is enqueue script / style only on specific plugin/admin pages.
<?php
add_action('init', 'my_plugin_admin_page');
function my_plugin_admin_page()
{
//create the menu page
$hook = add_menu_page(....);
//use the hook for this page for enqueuing
add_action('admin_print_styles-' . $hook, 'my_plugin_admin_styles');
}
function my_plugin_admin_styles()
{
//enqueue the style/script here
}
?>
This is one use I know.
Related Posts:
- add_submenu_page not working
- add_menu_page with no link
- How to point “add_menu_page” to HTML file rather than PHP function
- Auto add (multiple) Custom Post Types to menu
- add_menu_page the children get url encoded prefix
- add_menu_page include a php page from theme directory
- How is a widget supposed to reference what is added to custom submenu or addmenu fields?
- Highlighting admin submenu pages
- Not able to show the add_menu_page icon
- How to get data from option page [closed]
- usage of admin_url() in add_menu_page()
- do_shortcode() within Admin Page
- Show Custom Taxonomy Inside Custom Menu
- add_menu_page permissions – what am I doing wrong?
- Add custom page link with anchor
- How to remove duplicate link from add_menu_page
- How to use a WordPress’ existing admin icon?
- What is the use of $page_title and how to use it?
- Adding an admin page – OOP approach not working
- The seventh parameter passed to add_submenu_page()
- Generate Advanced Custom Fields box in custom admin menu page
- Add highlighting to new Admin Dashboard Menu Item
- How to add a sub menu with AJAX?
- difference between add_object_page and add_menu_page
- Master menu item for multiple plugins?
- Seriously stuck with some custom meta box/plugin stuff
- How to prevent parent admin page from appearring as a child admin page
- Admin Menus – Name Menu different from first Submenu [duplicate]
- add_menu_page() with function inside a class [duplicate]
- Enqueueing Scripts on a Custom Top-level Menu Page
- Settings page above CPT page in admin section
- How to change menu page capability
- How to avoid creating first submenu page that is same as menu page?
- add_page_menu to make shortcut to widgets
- Theme Options page not showing up in admin menu
- Why add_menu_page adds admin.php and how to remove it?
- Admin Dashboard with Custom Tab for Client
- Is there any way to add absolute path for add_menu_page function?
- add_menu_page() for more than one user role
- Where is the submitted $_POST array stored after an option page submission?
- Hiding Admin Page While Keeping Menu Expanded
- Associating custom submenu item with post type of top level menu item
- Wp menu add page link as custom empty link
- Determine Registered Admin Menus
- Insert & order custom post types in/as submenu
- Adding subdomain to home_url for “add_menu_page”
- add_menu_page does not seem to work in a class
- how to open page, defined in plugin, from dashboad widget
- add_submenu_page function to show videos table
- Set different custom menu items for different user roles
- Check if Page Already Exists in Menu
- Add_menu_page not displaying the menu in class based plugin
- Able to edit custom post, but unable to create new custom post when within submenu. What capability is missing?
- Add menu option to “New Post” menu in admin bar
- How to add tags in Submenu page or Menu page
- Pagination in plugin’s backend
- Dynamic admin submenu
- Add a page in admin without adding menu item
- Add_menu_page() error message -> “You do not have sufficient permissions to access this page”
- How can I highlight a top level dashboard menu item created for a custom taxonomy?
- Custom plugin settings link doesn’t append current class to menu item when visited? Why?
- why add_menu_page use simple function as arg while add_meta_box a call back?
- Finding the screen id of a page generated with add_menu_page
- meta box on new admin page
- WordPress add page under admin submenu and retaining the active status of the parent submenu page in the menu
- WordPress Settings API Repeatable fields
- Plugin add_action and add_menu_page
- How can I create a new menu item that links to an archive of a custom post type?
- Show category and tag link as a submenu under custom post type submenu
- Adding submenu to custom plugin menu page created with add_menu_page() function
- Plugin page and capabilities
- add_menu_page() with variable function
- How can I add/update post meta in a admin menu page?
- Add dashboard widget to page created with add_menu_page()?
- How to Call Specific .PHP file on add_submenu_page selection in Plugin Development?
- Custom admin menu order fails if slugs are complicated
- How to add styles to a submenu page?
- do_shortcode() within Admin Page
- add sub_menu to a sub_menu (multiLevel sub_menu) in admin menu in wordpress
- WordPress Settings API Overrides My Previous Value
- only last option from theme options is being saved to the DB
- Multisite Setup – Menu Items To Reference Pages in Different Subdomains
- Highlight active Admin Menu when added though add_menu_page
- Add item to admin panel – w/o plugin & theme
- Create WordPress Menu Item Without Linking to a Custom Page
- How to create a custom menu for specific user
- add menu page in loop menu order
- How do I create a new directory to hold the assets for a new menu item?
- how to create pages and link them to a menu
- How to add a menu page for options in wordpress for user that has the role of vendor?
- Add Admin menus or submenus depending on conditions
- Is it possible to have dynamic post id # in add_menu_page()?
- Cloning admin pages like users.php
- Pass custom css class to add_menu_page
- How to add admin bar only page?
- The menu item is not deleted on WordPress
- Footer navigation menu
- Is it possible to add Custom Dashboard Widgets to Custom Admin Menu Page?
- Change default URL (or permalinks) in the back-end
- Multiple plugins settings of same developer into ONE settings page linked together