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?
- Can I rename the wp-admin folder?
- How to remove screen options and help links in the admin area?
- How do I find all admin users using phpmyadmin?
- Can I add custom attributes while adding inline scripts?
- wp-admin produces a 302 redirect to itself
- Hide username from users list
- Remove HTTP: from the site URL and just keep // in it
- wp_enqueue_script vs. wp_register_script
- TinyMCE Autoresize
- WordPress wp-admin suddenly lost its style
- Activating Child Theme Breaks Website, Blank Page, Error 500
- Create Read Only Admin
- wp-admin is redirecting to back to home page (localhost)
- Rename W3 Total Cache admin menu
- WP Database Error (Windows Server 2008 & SQL Server)
- Cloned a site but can’t log in – redirecting to old site
- Can I edit the wp_post > post_content right before its inserted/updated?
- FORCE_SSL_ADMIN not working
- I get “The PHP Date/Time library is not supported by your web host.” on my CentOS host, what library to I need to install to add support?
- How can I allow core, plugin, theme update checks only for selected admins?
- wp_before_admin_bar_render action not working in back office
- Locked Out Of WordPress Admin Dashboard After Server Move
- Subscribers become Authors after Upgrade? / Mass Update of Users?
- map_meta_cap was called incorrectly error?
- How to set admin login page as home page
- conditionally load javascript & CSS for do_action() calls from plugin
- Redirect loop in /wp-admin/
- Modify WP-Admin login fields
- Create custom fields as image uploads [duplicate]
- 404 error comes up when I go to wp-admin after first installation [closed]
- Is there a quick way to find out what posts haven’t been tagged?
- wp-admin folder removed by hacker [closed]
- Cannot Access wp-admin as redirects to wp-signup.php?
- _wpnonce blank screen
- edit.php alter links
- Jquery function working in Dev Console but not otherwise [duplicate]
- How to replace “Password Protected” text with icon in Admin
- Delete the “wp-admin” folder – what could go wrong?
- How can I limit page parent dropdown to show only author’s own pages?
- Nickname field isn’t appearing in Admin
- External HTTP API calls slowing down WordPress admin [closed]
- Creating custom admin panel pages without making a plugin?
- Why is my ‘export’ option missing?
- Change users.php WP_User_Query
- Blank page when viewing wp-admin
- Is it possible to display my theme sidebar in wordpress admin?
- Programtically selecting image URL in Media Library modal
- wp-admin: “Sorry, you are not allowed to access this page.”
- How to access wordpress from domainB which is installed at domainA
- How to optimize the opening speed of admin panel?
- How to change the URL of sub menu page?
- Change wordpress admin home page
- Strange wp admin edit buttons issue
- Cannot access wp-admin after migration to another place
- Regular users logs in as ADMIN if Admin logged in recently
- Enqueue registered dependencies only when necessary
- Enable Excerpt field inside the post editor for pages
- When to use wp_register_script() function?
- Failed to load resource: the server responded with a status of 500 (Internal Server Error)
- WordPress switch domains
- Not able to access WP admin Page, redirected and a drop down login menu appears 401 error
- OSX El Capitan local install Maximum upload file size: 2 MB But php.ini set to 64M
- Is it possible to outsource wp-admin to another server?
- Wp mwnu not works at all
- Can’t log into WordPress after domain change
- Search box for hierarchical taxonomies in admin interface
- Custom Admin Message from external source to multiple users
- How can visitors redirect wp-admin to the homepage?
- Creating your own options-general.php page
- How can you change the admin dashboard URL without symlinking?
- Degraded WordPress admin dashboard performance [closed]