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 I was looking for. Thank you!
Related Posts:
- Enque script based on url paramater
- Why is WordPress enqueuing admin relevant scripts (e.g., React, ReactDOM, Redux, hooks, TinyMCE etc) when not logged in?
- How do I Enqueue styles/scripts on Certain /wp-admin Pages?
- wp_list_tables bulk actions
- Why are admin scripts not printed
- How to disable 3.3 Tooltips?
- Restrict access to admin but allow admin_post hook
- enqueuing React script and hooking its target div fails to load script
- Looking for a hook to add attachment information to the media library tab
- Add “Page Revised” column to Admin
- Stop loading “collaborators” users on add new post or page?
- Execute script only on certain admin pages
- Stopping user deletion from running on error
- When to use add_action when registering/enqueuing scripts
- ‘wp’ hook supposed to trigger when editing a post?
- How to use underscore.js in WordPress Admin
- Add and Remove Row Actions in an Existing WP_List_Table
- load-{$page hook} and returned parameter
- How can I prevent a function from loading in the admin screens?
- How to check if it’s edit.php & post_type is set?
- How do I add something to the “Edit Tag” page in wp-admin?
- How to load Dashboard default media files via HTTPS even when Browser URL has HTTP
- Remove menu item dashboard for a unique user
- Conditions for admin get_current_screen action parent_file edit.php?post_type=page
- True parameter but jquery register in header and not in the footer with wp_register_script
- Custom comment action
- admin_print_styles incuding $_SERVER[‘DOCUMENT_ROOT’]
- JavaScript file successfully registered but does not render correctly
- Action for opening edit page in admin?
- admin_enqueue_scripts not load custom scripts from cdn
- Organizing Code in your WordPress Theme's functions.php File?
- How to check if a user is in a specific role?
- Enqueue Scripts / Styles when shortcode is present
- Can I rename the wp-admin folder?
- When should I use wp_register_script() with wp_enqueue_script() vs just wp_enqueue_script()?
- Changing Admin Menu Labels
- Where is the right place to register/enqueue scripts & styles
- Adding custom columns to custom post types
- Adding Fields to the Category, Tag and Custom Taxonomy Edit Screen in the WordPress Admin?
- adding custom stylesheet to wp-admin
- Check if a script/style was enqueued/registered
- Can’t change language (only “English (United States)”)
- Is there ANY way to remove comments function and section totally?
- How to use “menu_order” field for posts?
- How to enqueue scripts on custom post add/edit pages?
- “Too many redirects” ONLY when trying to access wp-admin page
- How to restrict dashboard access to Admins only?
- Admin Page Redirect
- Disable dragging of meta boxes?
- Toggle admin metabox based upon chosen page template
- Unable to login and wp-login.php redirects to wp-admin%2F&reauth=1?
- How to properly dequeue scripts and styles in child theme?
- When moving a WP site, why does wp-admin redirect to old site?
- How to disable the “Post Lock/Edit Lock”?
- adding the category to the admin column for a custom post type?
- How can we make managing lots of pages in WordPress Admin better?
- Change page title in admin area
- do_shortcode() within Admin Page
- How can I control the position in the admin menu of items added by plugins?
- Changing the ‘wp-admin’ URL to whatever I want
- Unit testing in the WordPress backend (is_admin() is true)
- Admin ajax request return 0 with die()
- How to prevent access to wp-admin for certain user roles?
- How to remove screen options and help links in the admin area?
- How to remove the core embed blocks in WordPress 5.6?
- How to increase the file size limit for media uploads?
- Create WP tutorial for users with admin pointer using next button for navigation
- I’m getting a 404 message when I try to access wpadmin
- wp_enqueue_scripts, wp_register_scripts, wp_print_scripts: i’m confused
- Taxonomy dropdown metabox in the back-end
- wordpress wp-admin css not loading
- Sort admin menu items
- How to order by post meta name in wp admin?
- How set defaults on wpLink()
- Remove dashboard, use Pages tab as default
- Register and enqueue conditional (browser-specific) javascript files?
- How to redirect/rewrite all /wp-login requests
- Show all post tags on post edit screen/sidebox
- Correct Method to run scripts with dependencies without enqueue?
- How to hook in and modify the new revisions UI (3.6+)?
- How to display a static HTML page while setting up a WordPress site?
- Limit widget to certain sidebar?
- How can I uninstall a language?
- Check if user is admin by user ID
- My wordpress site gets redirected automatically to the old site any known solution for this?
- Best way to present options for home page in admin?
- Cannot deregister a script using wp_deregister_script
- Use a different domain for SSL
- Conditional wp_enqueue_script on a page
- Remove specific items from Quick Edit menu of a Custom Post Type?
- How to filter by post-format in admin?
- Unable to login to my wordpress site. reauth=1 redirection loop
- Add “external” link to admin menu in the backend
- How to Layer 7 Load Balance WordPress Backend and Frontend?
- Disable image attachment links
- How can I improve the line break handling in the WYSIWYG editor?
- Load js/css files only on specific admin UI pages
- Custom column for changing post status via ajax
- How do I change the login logo URL and hover title?
- Custom login redirects to wp-admin on wrong password