wp_enqueue_script()
utilizes the WP_Scripts
class, which extends the WP_Dependencies
class. If you checkout that class, you will see a bunch of arrays at the top. So you could actually loop through list of queued scripts like so:
global $wp_scripts; // If inside a function
foreach($wp_scripts->queue as $script) {
// Do some tomfoolery here... ;)
}
Also, if you use wp_enqueue_script()
, it won’t load the script more than one time. It actually checks to see if it’s been enqueued, so I think the above is moot anyway. Good to know either way.
References:
http://core.trac.wordpress.org/browser/tags/3.4.1/wp-includes/functions.wp-scripts.php
http://core.trac.wordpress.org/browser/trunk/wp-includes/class.wp-dependencies.php
http://codex.wordpress.org/Function_Reference/wp_enqueue_script
Related Posts:
- Enqueue script globally
- ajaxurl not defined on front end
- How to enqueue JavaScripts in a plugin
- In Which Contexts are Plugins Responsible for Data Validation/Sanitization?
- Plugin Form Submission Best Practice
- Best way to abort plugin in case of insufficient PHP version?
- What do you think about custom designed plugin/theme options UIs?
- Where to put third party PHP library?
- Optimize shortcode callbacks
- How to integrate a PHP webmail script into the backend of WordPress?
- How to log plugin errors to plugin error_log file
- jQuery in header or footer
- Which to use to execute code during the saving of a plugin settings page?
- Allowing for multiple template views on the Gallery Settings page when using the Visual Editor
- Using Primary Color in Plugin Block
- Where to enqueue stylesheets for plugin?
- When is it appropriate to put functions on page template vs. functions.php?
- Custom theme sufficient or custom plugin neccessary for this feature set?
- How to create custom home page via plugin?
- Adding callback function for wp_ajax_ has no effect
- Sessions not creating correctly in custom function
- When is it too late to call the action wp_enqueue_scripts?
- Use js script from one plugin in another plugin
- Featured Image not showing in admin
- Plugin Loading Scripts and Styles on Every Page – Even when not being used
- How do you output enqueued scripts to an admin page?
- Multisite plugin development and wp_enqueue_script
- is_page() function doesnt working
- Get the password key when using the wp_new_user_notification_email filter
- Order properties should not be accessed directly
- How to avoid loading same script twice?
- How to run a external JavaScript file on wp-admin if admin, and other if normal user?
- How to deal with equal & similar arguments for a function?
- Executing a function upon webhook calling wordpress
- Customizer: widget-synced triggers twice
- Loading scripts with wp_register_script and wp_enqueue_script
- how to use hook deleted_user into custom function to delete user from custom table
- Adding Dropbox dropin js using wp_enqueue_script
- Disable The Events Calendar plugin from loading its scripts
- Where to call wp_enqueue_script in a plugin with custom template?
- Where to store the name of a custom table?
- WordPress is automatically linking plain text email addresses
- Is Using WordPress Supplied WYSIWYG Advisable?
- Replacing Scripts in Admin Load_Scripts
- Maximum lifetime for nonce
- Clearing caches on plugin uninstall
- Custom Taxonomy to dropdown box on adminside wordpress
- How to modify the comments to be displayed in a post?
- Incorporate small angular feature in my wordpress site
- How to enqueue or include json file to a plugin
- How to load library scripts in admin from plugins in noConflict wrapper?
- jQuery does not enqueue for my purpose… (before an inline script in the footer)
- How to modify files inside wp-includes directory in wordpress
- How should I go about registering JavaScript that isn’t a file? [duplicate]
- How to set a cookie for logged in users to md5($user->ID . “my_secret”)?
- WP Plugin Running before jQuery
- should i be checking for jquery before enqueing it in a plugin
- Show message from backend
- Plugin Development – Class Constructor Not Firing wp_enqueue_style action hook
- Enqueuing scripts and styles in custom plugins
- How to enqueue scripts in right way in a plugin?
- Create Widget or Enable Shortcodes in Sidebar
- How to make my shortcode load scripts and styles, from within the plugin?
- How do I get rid of my inclusion race-condition on wp_enqueue_script
- Using function from enqueued .js file in theme in plugin?
- how to save wp_editor html content in options table
- Enqueueing common php scripts in a plugin
- How to use a WP_Customize_Control outside of the Customizer?
- How to remove/replace current page template?
- How to determine which capability to use?
- Custom Endpoint – Does it possible to use PUT method with WP API Rest?
- Why won’t this submenu page show? – My First WordPress Plugin
- How do I ensure I can loop through every enqueued script and CSS?
- Does hooking into a plugin action / filter override the plugin’s function for that hook?
- Javascript not being loaded only in custom taxonomy template
- Add a Script button in W3 Total Cache plugin not working due to conflicting jQuery version
- Enqueue scripts based on site.
- Determine if the current page, is being edited
- WordPress delete mysql rows with string
- external Integration with wordpress timeout error
- How to enqueue an external Javascript file to Frontpage footer
- Making adding info to an overlay bio easy for average user?
- Implementing Select2 plugin into WordPress
- Associating special meaning with user id 0
- Enqueue script not working
- Can I access WordPress API’s from within plugin scripts?
- Theming Custom Plugin Page
- Script work on non logged in user but not work for logged in user?
- Link to a admin submenu item using a custom link
- Adding class to the parent of current-post-ancestor / current-menu-parent / current-post-parent
- Change the search results header from plugin
- Dynamic banner for use on external sites
- How do I store a custom dataset in WordPress to best take advantage of API?
- Why does this fail: Disabling plugins enqueue_script() in functions.php
- Developing Themes on WordPress, Looking for Excellent Tutorials [closed]
- How to Implement SAM Broadcaster with WordPress? [closed]
- How to only Load scripts on variable products page
- Custom plugin not appearing
- Extend WP_List_Table class – Edit wp_usermeta – WPPB.me Boilerplate – Action error
- Is there any other ways to replicating changes on live from staging without pushing from git