I'm trying to add a java script file to my admin header and use admin-ajax.php to use ajax in my wp-admin (still learning a lot about the process). I've created a custom folder in my theme_directory/js called custom with the file I need to add to the admin header but it doesn't seem to be working. here's the code:
add_action('admin_enqueue_scripts', 'my_admin_enqueue_scripts');
function my_admin_enqueue_scripts() {
global $current_screen;
if ( 'page' != $current_screen->ID )
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' )));
}
Despite this I'm not seeing a reference in my header to my custom js file. I've even tried add_action('admin_header', 'my_admin_enqueue_scripts'); with no avail. I only need this script file in my wp-admin.
What am I missing? Thank you!
