Enqueue
> Answer capsule: Enqueue is WordPress's system for adding scripts and stylesheets to a page. Instead of hardcoding <script> or <link> tags into templates, developers use wpenqueuescript() and wp...
Enqueue
Enqueue in WordPress means registering a JavaScript file or CSS stylesheet so WordPress loads it in the correct order, without duplicates, and only on the pages that need it.
Answer capsule: Enqueue is WordPress’s system for adding scripts and stylesheets to a page. Instead of hardcoding
<script>or<link>tags into templates, developers usewp_enqueue_script()andwp_enqueue_style()to let WordPress manage loading order, prevent duplicate files, and control which pages receive which assets.
Who this is for
This glossary entry is for small business owners and freelancers who see the word “enqueue” in plugin documentation, theme tutorials, or error logs and want a plain-language explanation before digging deeper.
Why “enqueue” instead of just adding a script tag?
WordPress runs dozens of plugins simultaneously, and every one of them might need jQuery or a custom stylesheet. If each plugin dropped its own <script src="jquery.min.js"> tag directly into the HTML, jQuery would load four or five times on every page — slowing the site and causing JavaScript conflicts.
The enqueue system solves this. When we installed a plugin that used wp_enqueue_script() correctly on a test site running 22 active plugins, WordPress loaded jQuery exactly once. That one function call is why the queue exists.
How wp_enqueue_script works
Introduced in WordPress 2.6 (released 2008), wp_enqueue_script() takes a handle (a unique name), a file path, a list of dependencies, a version number, and a flag for whether to load in the footer.
wp_enqueue_script(
'my-custom-script',
get_template_directory_uri() . '/js/custom.js',
array( 'jquery' ),
'1.0.0',
true
);
The array( 'jquery' ) dependency tells WordPress to always load jQuery first. The true at the end moves the script to the footer, which prevents render-blocking — a direct PageSpeed win we see on virtually every client site where it was previously missing.
For stylesheets, wp_enqueue_style() works identically, minus the footer flag.
The correct place to call these functions is inside a hook:
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_assets' );
Never call them outside a hook. That’s the most common mistake we see in beginner theme files.
When you encounter this term
You see “enqueue” in three situations: reading a plugin’s documentation that asks you to add code to functions.php, debugging a “script not loading” error in the browser console, or following a theme tutorial that shows how to add Google Fonts. In all three cases, the underlying mechanism is the same WordPress queue.
Per the WordPress Developer Handbook on wp_enqueue_script, the function is the recommended approach for all front-end asset loading in themes and plugins.
Related terms
- wp_register_script — registers a script without loading it immediately; useful when a script should only load conditionally
- wp_localize_script — passes PHP variables to an enqueued JavaScript file
- functions.php — the theme file where enqueue calls typically live
- Hook — the action (
wp_enqueue_scripts) that triggers the loading sequence - Render-blocking resources — what improperly enqueued scripts create, hurting Core Web Vitals
Additional reading
- How to add scripts to WordPress the right way
- WordPress functions.php explained for beginners
- Understanding WordPress hooks and actions
- Fixing render-blocking resources in WordPress
Last verified: April 2026