Ok, I figured it out: If it’s a submenu page, the $hook
looks like this: appearance_page_page-name
instead of going by URL. So the complete code would be this:
function my_function($hook) {
if ( 'appearance_page_page-name' != $hook ) {
return;
}
wp_enqueue_style( 'custom-style', get_template_directory_uri() . 'custom-page/style.css' );
}
add_action( 'admin_enqueue_scripts', 'my_function' );
Related Posts:
- WordPress admin stylesheet
- Adding scripts to admin page in my theme
- Why are my styles being applied to the admin area?
- How to enable enqueue_script to work with a logged in user?
- How can I load an inline script after the enqueued scripts in admin?
- admin_enqueue_scripts not working
- jQuery UI AutoComplete & wp_enqueue_script
- How to enqueue admin content outside admincp
- Fixed layout for admin section
- admin_enqueue_scripts not rending JS file correctly
- Include script files for admin submenu page
- Enqueue script throws error in console
- How do I Enqueue styles/scripts on Certain /wp-admin Pages?
- What are the standard admin CSS id/class tags?
- Where is the right place to register/enqueue scripts & styles
- Conditionally Loading JavaScript/CSS for Shortcodes
- Admin Ajax is returning 0
- How do I dequeue a parent theme’s CSS file?
- Add custom column to Users admin panel
- Check if a script/style was enqueued/registered
- wp enqueue style on specific page templates
- wp_verify_nonce vs check_admin_referer
- Add a Separator to the Admin Menu?
- How to determine whether we are in add New page/post/CPT or in edit page/post/CPT in wordpress admin?
- how to know if admin is in edit page or post [duplicate]
- Load a script just to custom post type in admin
- How to load css in the footer [duplicate]
- Modal window from within WordPress admin
- How can I get a list of all enqueued scripts and styles?
- Where in WP can I check history or log of updates of plugins etc?
- Adding a custom admin page
- Load CSS/Javascript in frontend conditionally if block is used
- How does admin-ajax.php work?
- Prevent Version URL Parameter (?ver=X.X.X) on Enqueued Styles & Scripts
- How to remove entire admin menu?
- How to load Widget javascript + css files only if used?
- How do I remove dashboard access from specific user roles?
- How can I speed up my WP admin section?
- How to pass parameters to admin_notices?
- How to load scripts/styles specific for a page
- Admin: very slow edit page caused by core meta query
- if admin is logged in
- Search posts by ID in admin
- How to Change the Default Home Page for the WordPress Dashboard?
- Setting admin edit panels & metaboxes positions and visibility for ALL users and admins
- Find out which moderator approved comment?
- The website cannot display the page
- How To Remove WordPress Version From The Admin Footer
- Sort pages in loop by admin’s page attributes order field?
- Edit “thank you for creating with WordPress” in version 3.3.1
- Hide other users’ posts in admin panel
- Set Default Admin Colour For All Users
- Editor Styles and Typekit
- How can I de-register ALL styles all at once? And same with Javascript?
- How to add stylesheets only to pages with specific shortcode?
- This CSS Stuffing Works, But Is This A Good Practice?
- Is it possible to create a WordPress tour? V3.3.1
- Securing Admin Accounts – Username Discovery
- is_admin() returns true when using admin-ajax.php from front end script
- How to save dismissable notice state in WP 4.2?
- How do I optimize a custom post type admin page with 25,000 posts?
- Settings API – adding setting fields dynamically?
- Disable Media Uploads to non Admin Users
- How do I load a CSS style into WordPress admin area only?
- Allowing admin-ajax.php to receive “application/json” instead of “x-www-form-urlencoded”
- Can an admin check passwords of registered users?
- How can I target WordPress 3.8 new interface MP6 with CSS?
- Enqueue custom font file with rel=”preload”
- How do I force wp_enqueue_scripts to load at the END of ?
- Notification that the admin is online
- Does wordpress create activity, update logs?
- sort child pages on admin
- How-to make the admin area mobile friendly [closed]
- Load js/css files only on specific admin UI pages
- How to remove list view from media library?
- How to disable the “Your site has updated to WordPress x.y.z” admin email?
- Load plugin scripts and styles only on plugin page
- Plugin to remove Admin menu items based on user role?
- How to obtain the user ID of the current profile being edited in WP-Admin?
- 3.3: How do you hide the new dashboard welcome panel?
- Add my own button next to “Screen options” and “Help” in the admin
- Get list of scripts / styles and show file which enqueued them
- WP List Table custom quick edit box – post meta data missing and columns change on submit
- Settings API – easiest way of validating checkboxes?
- Are there any action like ‘init_frontend’
- Should I use is_admin() inside ‘admin_init’ hook callback
- Custom admin email for new user registration
- Send Admin Emails to Multiple Email Addresses
- Why I can’t add a CSS style in this WordPress theme?
- How do I set up the defualt page icon for admin menu?
- Removing specific style from wp_head
- Prevent author from changing their posts if admin has modified
- Cannot access admin panel
- How to dequeue / deregister any theme styles and scripts
- Make A WordPress Page Accessible To Admins Only, Redirect Other User Roles
- Disable all https in WordPress
- localhost/wp-admin on my local redirects to production site’s /wp-admin
- How to remove administrator role in settings -> general -> New User Default Role?
- Is there a more efficient admin search function/plugin?
- Can a users profile be put under the dashboard menu