There are a couple of ways to do this. The easiest way is to use $_GET:
if ( ( $hook == 'post-new.php' || $hook == 'post.php' ) && $_GET['action'] == 'edit' ) {
// Enqueue your scripts here
}
You can also use the get_current_screen(); function instead of using a global variable.
Related Posts:
- Trying to get custom js files in my admin header
- How do I Enqueue styles/scripts on Certain /wp-admin Pages?
- wp_list_tables bulk actions
- Why are admin scripts not printed
- How to disable 3.3 Tooltips?
- Restrict access to admin but allow admin_post hook
- Looking for a hook to add attachment information to the media library tab
- Add “Page Revised” column to Admin
- Stop loading “collaborators” users on add new post or page?
- Execute script only on certain admin pages
- Stopping user deletion from running on error
- ‘wp’ hook supposed to trigger when editing a post?
- How to use underscore.js in WordPress Admin
- Add and Remove Row Actions in an Existing WP_List_Table
- load-{$page hook} and returned parameter
- How can I prevent a function from loading in the admin screens?
- Why is WordPress enqueuing admin relevant scripts (e.g., React, ReactDOM, Redux, hooks, TinyMCE etc) when not logged in?
- How to check if it’s edit.php & post_type is set?
- How do I add something to the “Edit Tag” page in wp-admin?
- How to load Dashboard default media files via HTTPS even when Browser URL has HTTP
- Remove menu item dashboard for a unique user
- Conditions for admin get_current_screen action parent_file edit.php?post_type=page
- Custom comment action
- admin_print_styles incuding $_SERVER[‘DOCUMENT_ROOT’]
- Action for opening edit page in admin?
- Can I rename the wp-admin folder?
- How to restrict dashboard access to Admins only?
- How to remove screen options and help links in the admin area?
- I’m getting a 404 message when I try to access wpadmin
- wordpress wp-admin css not loading
- Check if user is admin by user ID
- Highlight custom widgets in the admin area?
- How do I find all admin users using phpmyadmin?
- wp-admin produces a 302 redirect to itself
- create users to site with specific language
- Hide a page in the admin end without a plugin?
- How to set custom editor style when editing the homepage?
- How to disable or hide “collapse menu”
- Login to wp-admin “redirect_to” points to wrong URL after migration
- TinyMCE Autoresize
- WordPress wp-admin suddenly lost its style
- Create Read Only Admin
- After changing Site url to https, can’t access login page
- Add custom content in user-edit.php page
- How to use Yoast SEO backend in english even if WPLANG variable is not english?
- How can I add my script to admin using script-loader.php?
- Admin first hook that outputs HTML?
- Remove “Get Shortlink” button in admin of custom post type
- How to load script-related styles automatically?
- To remove default dashboard items and add quick draft widget for custom post type
- Why am I unable to login after converting to www?
- why my menu is not appearing on the admin panel
- Can’t access WordPress as an admin – but I can log in as a user!
- How to create a WP Admin user in phpMyAdmin for WordPress 4.6
- How do I host WordPress on a hidden domain through a reverse proxy?
- Add javascript confirmation popup on “Move to Trash” link
- Users disappeared from wp-admin
- Create custom fields as image uploads [duplicate]
- 404 error comes up when I go to wp-admin after first installation [closed]
- Is there a quick way to find out what posts haven’t been tagged?
- WordPress (behind HAProxy and Jetty), not multisite, in sub folder – and /en/wp-admin/ keeps redirecting to /wp-admin/
- Created a new subdomain with same content. Should I add a redirect in my old subdomain?
- WordPress isn’t reflecting changes I make to a specific file via FTP [closed]
- Admin menu in front-end
- Custom Admin Pagination links
- Have different site location for wp-admin in IIS
- Lost administrator privileges and can’t find a fix
- Why does do_robots() Allow: /wp-admin/admin-ajax.php by default?
- Enqueue script globally
- What is the meaning or function of this notice?
- How to set where user is redirected to after logging in at wp-login?
- Restrict submitters from wp-admin [duplicate]
- How change a core block label
- Cannot redeclare wp_update_core()
- Remove WP Admin Menu Items by User Role
- Restrict access to admin-post.php
- How to create dependent dropdown custom field in wordpress admin post form
- How do I make it so that the all users page is not a white screen?
- Show shipping class on product admin page
- How to use wp_enqueue_script properly?
- Detail view for an element in a list the admin site
- How to check if a user is in a specific role?
- Accessing wordpress tool in local MAMP Site
- How to move “Collapse Menu” to top of admin bar?
- Some fields in Settings API form are saving, others are not
- I cannot get the “Read More” button to work!
- Child theme loses wp-admin styling
- wp-admin redirects to standard wordpress page
- Options site set empty fields after submitting
- Admin section showing CUSTOM Permalink structure thus resulting in permission error [closed]
- Moved from WP.Domain to Primary Domain, Can’t Login
- Weird admin area
- Admin panel: Javascript not loading properly. Cannot edit pages/posts [closed]
- Non Object Notice Error – How to fix please
- wha does the following function remove from wordpress users admin area? [closed]
- Where are the Parent themes CSS & PHP files hidden on WordPress?
- Site admin can login but cannot access wp-admin after domain migration?
- Why when I click on a link into the WP admin panel I am redirected to a link that doesn’t contains wp-admin prefix, so I obtain 404 error
- How to make the Panel // WP-Admin lighter via Mobile
- WP dashboard messed up