If you want enqueue style on all admin pages You can use the following code
function load_custom_wp_admin_style() {
wp_enqueue_style( 'custom_wp_admin_css', plugins_url('css/style.css', __FILE__) );
}
add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_style' );
Or if you want enqueue style on specific pages, You can use the following code
function load_custom_wp_admin_style($hook) {
if($hook != 'toplevel_page_myplugin' || $hook != 'widgets.php' || $hook != 'edit.php') {
return;
}
wp_enqueue_style( 'custom_wp_admin_css', plugins_url('css/style.css', __FILE__) );
}
add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_style' );
Related Posts:
- add_menu_page() with different name for first submenu item
- How to add sub-menu to a menu generated by wp_nav_menu by using plugin
- Change the_title() of a page dynamically
- How do I programatically insert a new menu item?
- Add Dividers or Separators Between Nav Menu Items
- Nav Menu meta failing to import
- Overwriting Core WordPress Functions with Plugins
- Some nav-menu filters do nothing
- Determine which theme location a wp_get_nav_menu_items is for
- Can I add pages to my custom menu via script?
- Replacing WordPress menu functionality with a plugin
- Hook event for upload image in the menu
- Why isn’t the Settings API designed to work for plugins using custom admin menus? [duplicate]
- How do I approach removing menu items on the fly based on settings in my plugin?
- What is the difference between current_page_parent and current_page_ancestor?
- Delete a specific item menu when I deactivate my plugin
- Create a Page via plugin
- Add Submenu Link in add_submenu_page That Opens in a New Window
- How to assign a WP 3.0 custom nav menu to a theme’s navigation menu location via script?
- Header Button Chance Polylang Elementor
- PHP 7 – Class Method Compatibility Issue
- How to add pages to custom menus on the fly [duplicate]
- How do I add a custom sublevel menu specified in one directory to a custom top level menu specified in another directory?
- Add notification bubble notice in navigation using transients
- Get Current Menu Location inside Nav_Walker
- Adding custom fields to WordPress nav menus
- Sub Menu content is being duplicated
- Plugin menu addition in multisite
- Remove unwanted elements for a wp_nav_menu
- Is this best practice for Dynamically adding items to WordPress menus?
- How to remove or add submenu item on plugin activate or deactive
- Custom code for WordPress dynamic menu
- How do I access the menus produced by Dashboard > Appearance > Menus
- wordpress add_submenu_page adds broken link
- Add child pages to submenu automatically
- Customize existing menu item
- Menu page with minimum capability as ‘Subscriber’ doesn’t allow ‘Admin’ to access it?
- Issue with plugin sub menu and pages
- How to add Plugin functionality in WordPress Frontend Menus
- How to hide page links from theme menu
- WP_NAV_MENU filter targets all menus
- How do I add a menu item to a Pods admin menu?
- Add user managable titles to custom menus?
- How to create archive page to add in menu
- How to show only the last two categories in a menu?
- Always hide a page from the menu
- remove different admin menu for specific users
- How to get an array out of a nav menu if it’s a plugin?
- What happens when you create/edit a menu
- Plugin admin list pages as submenu
- Adding parent custom post type menu option
- Create and style menu
- Change the class of wordpress menu
- Invalid Menu Items
- Declaration of mandoe_menu_walker::start_el(&$output, $item, $depth, $args) must be compatible with Walker::start_el(…)
- Custom Nav Walker $item->url producing malformed hyperlinks
- Displaying an Uploaded Image as a Custom Avatar in WordPress
- Adding a navigation with wp_nav_menu() to a custom block in the site editor
- How do i best handle custom plugin page actions?
- Automatically determine minimum WordPress version required for a plugin?
- Create a custom admin page for custom post type + taxonomies + metas
- Enqueue script only when shortcode is used, with WP Plugin Boilerplate
- add_filter OO with parameters
- Using the component outside the editor. select(‘core’) is null
- Gutenberg is there a way to know if the current block is reusable?
- Any ideas how to make unit test read the theme functions.php?
- WordPress Ajax callback function from plugin – OOP
- StackExchange clone using WordPress?
- Custom url for a plugin page add_rewrite_rule WordPress
- Verify if user is wordpress logged in from another app since wordpress 4.0
- how to get link of added document with a post
- Doubts about the use of metadata and how this can affect performance on WordPress
- How can I replace content in the WP Admin area before an admin page is rendered?
- When is the proper time to minify css and js with git workflow?
- Get draggable widgets on Edit Post page
- Plugin that saves form data
- how to invoke wordpress API from other existing PHP system
- Warning: include(): https:// wrapper is disabled in the server configuration by allow_url_include=0
- How to get the post excerpt using post object?
- jquery & ajax sending data to php
- How to import the css in the plugin admin area?
- In wordpress plugin wp_signon shows error
- How to find where an object first instantiatiation
- Problem with autoloader and namespaces
- Clean way to initialize plugin in newly-added site when plugin has been network activated?
- How to deal with different jQuery versions?
- Can I attach a plugin via my add_filter callback contents?
- WordPress Favicon not Working For Images/Videos/PDFs
- Is “document loaded” different on admin side than public side?
- Yoast and another plugin
- Handle changed Woocommerce function
- Making Woocommerce optimized for more than 500k products
- How to set custom homepage via a plugin
- Add placeholder into contact form 7 recaptcha text field
- add_rewrite_rule not working
- Adding a custom button to WordPress Add Post (and Edit Post too) screen, that can save the post
- Add admin settings and options
- mysql_real_escape_string() error using xml2ary in WordPress plugin
- Developing a wordpress.com shortcode [closed]
- Modify a Themes Appearance >> Header admin screen from a plugin