In terms of the basics, I have learned that there are two actions to hook – wp_print_scripts
and wp_print_styles
which I understand are called just before they are then added to the header.
add_action( 'wp_print_scripts', 'my_list_scripts' );
function my_list_scripts() {
global $wp_scripts;
$enqueued_scripts = array();
foreach( $wp_scripts->queue as $handle ) {
// do something clever
}
}
add_action( 'wp_print_styles', 'my_list_styles' );
function my_list_styles() {
global $wp_styles;
$enqueued_styles = array();
foreach( $wp_styles->queue as $handle ) {
// do something clever
}
}
Related Posts:
- Changing Plugin Load Order
- Load js/css files only on specific admin UI pages
- Get list of scripts / styles and show file which enqueued them
- unable to stop loop when using wp_insert_post with publish_post hook
- Multisite plugin development and wp_enqueue_script
- is_page() function doesnt working
- How to avoid loading same script twice?
- Plugin Development – Class Constructor Not Firing wp_enqueue_style action hook
- Custom Plugin – CSS works, JS doesn’t
- Enqueuing scripts and styles in custom plugins
- How to enqueue scripts in right way in a plugin?
- Why enqueue styles on hook?
- How to make my shortcode load scripts and styles, from within the plugin?
- Enqueue a file that’s not js or css
- Enqueue ONLY Plugin Styles and Scripts
- plugin css is not being applied to the page
- How to avoid conflict if a plugin already have included open library?
- How to only Load scripts on variable products page
- How to add a javascript snippet to the footer that requires jQuery
- Admin settings update updating every time home page is hit?
- Global Objects and Public Methods
- How do you use the plugin boilerplate loader class to hook actions and filters?
- Enqueue script only when shortcode is used, with WP Plugin Boilerplate
- Does WP fire delete_post when trashed posts are automatically deleted?
- Why does do_action pass a blank string as the first parameter if no $arg is set?
- How to add a link to WordPress Plugin install Listing
- Call activation hook multiple times
- Two-step login process – Is it possible?
- How can I hook into existing WordPress Bulk actions?
- Get returned variable from a function to add_shortcode function
- Why does wp_enqueue_script ignore my ‘wp_head’ hook?
- WordPress Media mime type filter problem 4.0
- Earliest WP Hook to Safely and Reliably Redirect
- Define a function outside a class and call the function using action or filter hook
- What is the best way to overwrite /wp-admin/ms-delete-site.php
- Inserting JS snippet in the footer if there is no wp_footer?
- Can I differentiate between “Delete Post Permanently” and “Empty Trash” and do something for each accordingly?
- Can’t get JS code to work with shortcode
- Synchronize Custom post type tags to WordPress default posts tags
- Where should I store global data for my multi-site WordPress plugin?
- How do I add a javascript file to all admin pages via a plugin?
- Hook into theme-switching later than `setup_theme`
- Is it possible to delay execution of shortcode output callback?
- WordPress Ajax callback function from plugin – OOP
- Why my database table not created on activation?
- Hook after wp_enqueue_scripts
- Act on user meta updated, but only once
- Is there any way to allow a plugin to write over a previous version?
- best practice for query string values – get_query_var always empty for my value supplied in query string
- get_current_screen() return null
- Is there a way to ensure plugin script loads before another script?
- Gutenberg blocks not getting styled on back end
- Modifying meta tags after doing ajax call in plugin
- how to add custom functionality after woocommerce place order button
- What is the proper way to include Bootstrap when executing a shortcode
- conditionally load javascript & CSS for do_action() calls from plugin
- What stylesheets are available in core?
- Conditional hook based on the core function that is calling it
- How to enqueue style in WordPress plugin from theme files?
- Enqueue script globally
- how to invoke wordpress API from other existing PHP system
- How dynamic action login_form_{action} is working
- WP Multisite login not working on one subsite. Possibly cookies/ history issue?
- How to get all queries’s results after they have executed?
- wp_localize_script is not adding a global variable for javascript
- Loading Modernizr (or other JavaScript libraries) for use in a plugin
- How to import the css in the plugin admin area?
- Odd map_meta_cap $args on post edit — sometimes integer, sometimes string
- How can I create a custom plugin that allows anonymous users to signup without registering?
- Associate multiple email addresses with the same user account, so they can log in with either
- WP: Search and replace in DB programmatically
- Custom filter not working
- Configure WordPress to Generate Scheme-less Relative URLs
- How to get current logged-in user details in multisite?
- add_action wp_ajax_ not loading in plugin file WP Network
- Ajax +wordpress onClick link redirect to new page and create html content
- How to replace settings in WordPress plugin from a theme
- Enqueue scripts inside a class in a plugin
- WordPress Plugin Authoring question about jquery and css
- Creating posts with links from a txt file
- apply_filters() and call_user_func() to define and call a function outside a class
- wordpress plugin add page when activate
- Add default value from selection
- Plugin Development – Call to undefined function comment_exists()
- Replace “content-area” of themes 404 page with plugin?
- Ajax Response Error | just getting error as the response
- Prevent plugin activation and add admin notice
- Does WordPress have something like timer hook?
- Same header/footer in Admin, across all network sites in multisite
- Chosen Select jquery Not Working in Plugin
- Can I use a hook other than ‘init’ to handle form submissions?
- Template file structure , wordpress hook for altering the template
- How do I replace title with my plugin?
- Looking for Hook that is fired after a plugin or wp upgrade is installed/updated
- Enqueue Script in custom plugin before other
- Woocommerce: block user removing cart item
- How can I get a plugin to hook ‘dbdelta_queries’ — a filter used during version update?
- Send retrieve password notification email with custom HTML email template
- Ninja Forms: Front-End Forms, Post ID?
- Execute callback after REST API request completes + Response is sent