Trying to get custom js files in my admin header
Ahh ok I figured it out while researching. I needed to add the $hook parameter and pass it to my function like so: function my_admin_enqueue_scripts($hook) { global $current_screen; if ( ‘post.php’ != $hook ) return; wp_register_script(‘my-scripts’, get_template_directory_uri() . ‘/js/custom/my-scripts.js’ ); wp_enqueue_script(‘my-scripts’); wp_localize_script(‘my-scripts’, ‘wp_ajax’, array( ‘ajaxurl’ => admin_url( ‘admin-ajax.php’ ))); } This gave me the results … Read more