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?
- Changing the ‘wp-admin’ URL to whatever I want
- How to display a static HTML page while setting up a WordPress site?
- How can I uninstall a language?
- Best way to present options for home page in admin?
- How can I improve the line break handling in the WYSIWYG editor?
- Delete Post From front Page ( With Wp-admin restriction )
- Custom user role that can only edit specific (non-custom-type) page and all child pages [duplicate]
- Add mass action to wp-admin/users.php
- Only allow administrators and editors to access wp-admin
- Add button in TinyMCE editor to insert text
- wp-admin – save options without refreshing?
- How to get the password and username of the add new user form (admin back end) in wordpress
- WordPress Error establishing a database connection For Admin login only
- How do you modify CSS files via admin panel?
- Image editing: “Edit Original” and “Replace” buttons missing on old posts
- WooCommerce – filter by featured products in admin
- How to prevent parent admin page from appearring as a child admin page
- Replace wordpress login logo with custom text
- How to clone wp-admin and make a new dashboard controlled by your code?
- What is an “Options Framework” for WordPress
- show/hide toggle for subpages in wordpress admin area
- After login get “403 Forbidden”
- How to display a Ninja Form on the WordPress admin pages
- Why are my frontend theme styles bleeding into the backend?
- Show Welcome Panel on Dashboard for every user
- Is it possible to add an item the Post Publish panel?
- Uncheck the box “Send User Notification” by default on new-user.php
- WordPress Options Page not working
- Admin account locked out/redirect loop. Other accounts work?
- Add count for new registered user in Users tab
- How To Differentiate Drafted product and Publish Product through Color?
- WP admin page gives 404
- How to prevent the editor from redirecting to website within iframe?
- wp-admin remove part of the url
- wp-admin 302 redirects
- WP admin user search doesn’t return all users
- Where are screen options when in admin on mobile?
- post-new.php?post_type=product is not loading properly
- wp-admin redirects to 404
- Generate PDF using tcpdf from WordPress admin side custom page [closed]
- Is wp-admin/about.php required? Can i omit it from my website
- meta box on new admin page
- Site Crashes When Updating to WordPress (Version 3.6)
- Change of IP Address
- How can I control which plugins run in the dashboard?
- Where to place add_action when enqueueing?
- WP Admin Login keeps redirecting to login
- WordPress admin section appears broken
- Is WordPress secure enough for a multi-user article directory?
- Wp-admin widgets have no title texts
- How to create directory under my active theme directory
- CPU overload spam – redirect link to wp-admin and new post
- define two login page url
- On Users (user.php) in wp-admin disable/hide “Bulk Actions” and “Change Role To”
- Login issue with subdomain installs
- Redirect from wp-admin back to page
- How can I can I make changes to a WP project I pulled from GItHub?
- WordPress critical error on wp-admin page with 100% permissions
- WordPress Redirects to a cancelled domain, need to change it but can’t get to the admin portal
- WordPress Admin Login Issue
- Add item to admin panel – w/o plugin & theme
- Wp-admin Redirection loop after moving to subdirectory
- site identity will not update [closed]
- Show only childs and grandchilds of certain post in admin
- WordPress logged in but no access to wp-admin
- Changed the path to wp-login and now can’t access WPress dashboard
- Creating another wordpress site as sub-domain of a wordpress site
- I can’t enqueue Suggest.js in frontend – not added
- Is it possible to change the images source that are shown in the admin side?
- Using query string on edit CPT page
- $current_screen if condition for a specific page in admin
- All of my WordPress sites have Bold Open Sans
- wp-admin blank page after admin login and all security off
- How can you change the admin dashboard URL without symlinking?
- Degraded WordPress admin dashboard performance [closed]