I'm using the following to enqueue a script in admin.
function add_admin_scripts( $hook ) {
global $post;
if ( $hook == 'post-new.php' || $hook == 'post.php' ) {
if ( 'custom' === $post->post_type ) {
wp_enqueue_script( 'myscript', get_stylesheet_directory_uri().'/js/custom.js' );
}
}
}
add_action( 'admin_enqueue_scripts', 'add_admin_scripts', 10, 1 );
But I want to enqueue when action=edit
is in the URL parameter.
http://mysite/wp-themes/my-theme/wp-admin/post.php?post=185&action=edit
Is this possible?