Can anyone point me to some sample code for adding JS code to a specific Edit Screen?
IE: Post-Type = “bubba”, I want to add JS when the “bubba” post-type is being edited by the end-user.
So apparently part of my answer is here, in the old Codex:
https://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts
Just need to figure out how to determine WHICH cpt is being edited.
function my_enqueue($hook) {
if ( 'edit.php' != $hook ) {
return;
}
wp_enqueue_script( 'my_custom_script', get_template_directory_uri() . '/myscript.js' );
}
add_action( 'admin_enqueue_scripts', 'my_enqueue' );