我正在使用以下命令将脚本排入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 );
 但我想在什么时候排队
action=edit 在URL参数中。
http://mysite/wp-themes/my-theme/wp-admin/post.php?post=185&action=edit
这可能吗?
 
                    最合适的回答,由SO网友:Johansson 整理而成
                    有几种方法可以做到这一点。最简单的方法是使用$_GET:
if ( ( $hook == \'post-new.php\' || $hook == \'post.php\' ) && $_GET[\'action\'] == \'edit\' ) {
    // Enqueue your scripts here
}
 您还可以使用
get_current_screen(); 函数,而不是使用全局变量。