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
- wp_enqueue_script() with unknown path and maybe symlink
- template_redirect or admin-ajax.php?
- WordPress custom taxonomy check box to dropdown
- Force HTTPS 301 redirect with hook
- How to load library scripts in admin from plugins in noConflict wrapper?
- I have 2 plugins using the same wp_login action hook and one is not working
- Selectively update themes in WordPress multisite
- Where is the right place to register/enqueue scripts & styles
- jQuery does not enqueue for my purpose… (before an inline script in the footer)
- Add a new confirmation page before saving
- Problem with context in multisite – getting main site data in every blog (get_pages())
- CSS not affecting widget output
- Enqueue script globally
- how to invoke wordpress API from other existing PHP system
- use of do_action() without any functions attached
- How dynamic action login_form_{action} is working
- WP Multisite login not working on one subsite. Possibly cookies/ history issue?
- What happens when two or more plugins use the same hook?
- What action hook can I use to add a JavaScript to a page post using a theme template that is not including get_header() nor get_footer()?
- Does admin_print_scripts-$hook_suffix work for nested paths to individual files?
- How to get all queries’s results after they have executed?
- register_activation_hook on multisite
- WP Plugin Running before jQuery
- wp_localize_script is not adding a global variable for javascript
- Plugin uninstall function is not working
- Loading Modernizr (or other JavaScript libraries) for use in a plugin
- Bug: Post needs to be updated twice when adding action for save_post hook
- should i be checking for jquery before enqueing it in a plugin
- flush rewrite rules after plugin update?
- When does save_post hook fire on post save/update
- Plugin does not add action
- Remove an action by extending class and replacing it
- WordPress plugin enqueue scripts working for js, but not css files
- How to import the css in the plugin admin area?
- Add child pages to submenu automatically
- My stylesheets are not enqueuing
- After plugin activation hook
- How to replace default comments with custom HTML?
- Odd map_meta_cap $args on post edit — sometimes integer, sometimes string
- Trying to get class to instantiate ONCE (or, “why do I keep punching myself in the head?”)
- How can I create a custom plugin that allows anonymous users to signup without registering?
- hook filter after the_content on a specific page
- Bind a function with its own argument to show something dynamically after every content
- Is there an admin hook that will let me read GET variable before it’s too late to set the header Location
- What’s the hook for filtering every texts of site?
- unable to wp_enqueue_script(‘suggest’);
- WordPress multisite,use same cookies across all website?
- How to check via conditional tags for a single plugin page?
- Hook add_attachment error
- Call to undefined function is_home() or any conditional tags
- Associate multiple email addresses with the same user account, so they can log in with either
- WP: Search and replace in DB programmatically
- WooCommerce change Tax Class programmatically when Recalculating an existing Order [closed]
- Run command “composer install” when activating wordpress plugin
- Update variable value via add_filter
- Add a check box in Menu Settings
- Custom filter not working
- How do I get rid of my inclusion race-condition on wp_enqueue_script
- hook update_option/updated_option empty $old_value and $value
- Using function from enqueued .js file in theme in plugin?
- Configure WordPress to Generate Scheme-less Relative URLs
- Hide one specific woocoomerce product
- Enqueueing common php scripts in a plugin
- How to get current logged-in user details in multisite?
- How to find list of all functions bind to a particular hook from my plugin?
- Can I Hook Into the TinyMCE Insert/Edit Link Button to Use Shortlink For Post?
- is it possible to hook every page style?
- add_action wp_ajax_ not loading in plugin file WP Network
- Using init hook for register_taxonomy is causing invalid_taxonomy in wp_insert_term()
- Ajax +wordpress onClick link redirect to new page and create html content
- Clean way to initialize plugin in newly-added site when plugin has been network activated?
- How to replace settings in WordPress plugin from a theme
- Redirect returning users to a certain page?
- How to share user data across multiple WordPress websites?
- Enqueue scripts inside a class in a plugin
- Is there anything special required to make a plugin work in a multisite environment?
- Restrict certain actions to plugin-specific admin menu pages only
- How to edit wp-signup.php content using plugin
- CSS not being applied using wp_enqueue_style
- wp_enqueue_scripts in a plugin’s class
- WordPress Plugin Authoring question about jquery and css
- Loading Images from Javascript on the Front End