/** * Enqueue a script in the WordPress admin, excluding edit.php. * * @param int $hook Hook suffix for the current admin page. */ function wpdocs_selectively_enqueue_admin_script( $hook ) { if ( 'edit.php' != $hook ) { return; } wp_enqueue_script( 'my_custom_script', plugin_dir_url( __FILE__ ) . 'myscript.js', array(), '1.0' ); } add_action( 'admin_enqueue_scripts', 'wpdocs_selectively_enqueue_admin_script' );