Used By
Used By | Description |
---|---|
wp-includes/script-loader.php: wp_enqueue_scripts() | Wrapper for do_action( ‘wp_enqueue_scripts’ ). |
Fires when scripts and styles are enqueued.
wp_enqueue_scripts
is the proper hook to use when enqueuing scripts and styles that are meant to appear on the front end. Despite the name, it is used for enqueuing both scripts and styles.
function themeslug_enqueue_style() { wp_enqueue_style( 'my-theme', 'style.css', false ); } function themeslug_enqueue_script() { wp_enqueue_script( 'my-js', 'filename.js', false ); } add_action( 'wp_enqueue_scripts', 'themeslug_enqueue_style' ); add_action( 'wp_enqueue_scripts', 'themeslug_enqueue_script' );
Version | Description |
---|---|
2.8.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/wp_enqueue_scripts