Instead of hooking into admin_print_scripts only, you should hook into your specific page slug which is appended to admin_print_scripts-. (note trailing hyphen). The reference page you linked to shows this, but you seem to be omitting the $page concatenation to admin_print_scripts-.
eg:
$page = add_theme_page( 'Options', 'Options', 'edit_theme_options', 'options-panel', 'topf_admin_options_markup' );
add_action( "admin_print_scripts-$page", 'enqueue_my_admin_scripts' );
I’m using the slug $page returned from add_theme_page; you should provide your own slug. Scripts will only be loaded for your specific page and there is no need to check within your enqueue function.
Related Posts:
- Adding Additional Attributes in Script Tag for 3rd party JS
- Conditionally enqueue a widget’s script/stylesheet in HEAD (only when present on page!)
- force enqueue script to be first in order of prominence
- Loading external page template and enqueue script from plugin causes 403 forbidden error
- How do I force wp_enqueue_scripts to load at the END of ?
- When can you get current page ID and initialize hooks right after?
- enqueue script only if it is not already enqueue
- Get php var inside javascript file (making plugin)
- How can I dequeue a Plugin Stylesheet?
- Which method is best to enqueue scripts
- Get info (url) from already enqueued styles
- WordPress Enqueue Script Chaos (jQuery & Foundation.js)
- Declaring script dependencies between scripts enqueued with different action hooks
- Pass $this to function nested in another public function of the same class
- Very stubborn wp_register_script / add_action vs remove
- Dequeue / Deregister script and replace it with a new plugin
- Add extra parameter in tag using script_loader_tag
- dequeue not work
- Custom data-id wp_enqueue_script
- Overriding a function in wordpress
- How to avoid redefining requirejs in plugin when another plugin also uses requirejs
- wp_enqueue_scripts not working inside shortcode
- wp_enqueue_script fails to include in footer
- How do I make sure a plugin loads a script after jQuery
- Problem with wp_enqueue_scripts in plugin
- Avoiding Duplicate function names in Post Loop (WP_Footer script)
- Calling JavaScript file with Custom Plugin
- Register script in one plugin, and enqueue it in another
- Problem in loading javascript in footer
- How to remove style and js from theme and add your own style and js where shortcode is used?
- React JSX in WordPress Plugin Development
- Use wp_enqueue_scripts from included php file
- issues with wp_enqueue_script in my plugin
- Making a plugin only available on the front-end for the logged in super admin
- Enqueue WordPress plugin scripts below all other JS
- Making sure that a plugin’s scripts and stylesheets are included for dynamicaly loaded content
- jQuery for custom plugin not working with Divi theme
- Bootstrap and Custom CSS in custom plugin are being overwritten by theme
- How can I remove the WordPress-Version (?ver=5.x) from my plugin
- Create shortcode to echo javascript
- Is there a loading priority for login_enqueue_scripts?
- Why am I unable to load scripts in head in plugin?
- Deactivate JS Script in Plugin Shortcode
- Remove / overwrite some functions in buddypress.js
- Add type to enqueued script inside plugin
- wp_dequeue_script for a Plugin
- Custom plugin – load enqueue only for this plugin
- Enqueue script: link not working in page source
- Deregister scripts from plugin
- Custom CSS not being added by plugin
- why the wp_register_script doesn’t work for register_activation_hook
- How to enqueue some javascript source once per page
- force jQuery to load in the head
- What is the most effecient way of enqueuing scripts based on the current plugins template?
- Edit all $wp_scripts at once to $in_footer = false
- Edit all $wp_scripts at once to $in_footer = false
- WordPress load same script two times
- Why won’t wp_enqueue_script work within any plugin file?
- wordpress plugin add page when activate
- Changing the CSS with a plugin
- Enqueue plugin for specific pages
- Why can I not deregister my style and script on custom post type?
- plugins_url not returning correct directory
- How do I keep children of certain parent menus expanded by default on a sidebar?
- Problem in functions.php file
- How to install jquery dotdotdot plugin for WordPress?
- WordPress include scripts and style in plugin page
- Plugins enqueuing jquery in head
- plugin’s script and style enqueing not working on Thesis
- Enqueue scripts in the footer
- Trying to use wp_register_script/style and enqueu them from an array – getting an error [duplicate]
- Scripts don’t enqueue after removing plugin
- wp_enqueue_script doesn’t load JS in plugin
- admin_enqueue_scripts using hook_suffix vs GET page
- Frontend Enqueued Files in the Backend
- WordPress Gutenberg Custom Block the viewScript does not get loaded on the frontend when my block is inserted
- Getting Path To Uploaded Attachment Image After Upload
- Error when updating plugins by FTP “Unable to locate WordPress Content directory (wp-content).”
- Building a scalable WordPress favouriting plugin – one serialised meta value array or many meta records
- Why is the unrendered widget number `__i__` showing up in the JavaScript but not in the HTML?
- Use plugin multiple times
- Cron jobs not working in WordPress plugin in a VPS with VestCP control panel
- Creating mySQL procedure with $wpdb
- WooCommerce: Building a page with user input which is used to query order status and external API and return a result
- add custom filters to the event calendar plugin programatically to frontend [closed]
- Editable form for WordPress plugin options page
- wp-pagenavi getting 404 page not found
- remove add new post, if there is already one post
- Hide a Menu Item on Login
- Quiz with complex output/result
- Using Class loader in WordPress boilerplate
- $wpdb->insert not working inside save_post tag
- How to get data from a private API and add it to wordpress pages
- WordPress 4.1 plugin only save 1 field to database
- WordPress custom posttype meta values doesnot save
- get_option include in my adsense
- woocommerce product categories in menu [closed]
- On the same site, how do I send data from a plugin file to a theme file?
- How to change the version of block.js and plugin to the same of Package.json?
- Warning “Attempt to read property ‘feeds’ on null” using post update function