Enqueues MU Plugin is a modern, flexible system for automating and customizing asset loading in WordPress themes and plugins. It is designed for maintainability, performance, and extensibility—supporting both classic and block-based development.
Note: All Webpack automation features are optional. You can use only the PHP asset loading/controllers, or only the Webpack utilities, or both together. Loading and initializing controllers is also optional and context-dependent—see Quick Start for details.
- Automatic Theme Asset Loading: Load CSS/JS for each page type, template, or post type—automatically, with smart fallback.
- Block Editor Integration: Register custom blocks, block categories, and block editor plugins with fine-grained control.
- Webpack Automation (Optional): Dynamically generate Webpack entries, copy assets, and extract dependencies for a seamless build process. All Webpack features are optional and can be used independently.
- Inline Asset Registration: Easily add critical CSS/JS directly to your page head or footer.
- Extensive Filters & Extension Points: Customize every aspect of asset loading and block integration.
- Troubleshooting & Advanced Usage: Solutions for common issues and advanced scenarios.
- Install via Composer
composer require thecodeco/enqueues:dev-main
- Initialize in your theme or plugin (Optional)
You only need to initialize controllers if you want to use the automated PHP asset loading features. You can use the Webpack utilities or other features independently.
\Enqueues\enqueues_initialize_controllers('theme');
- Start customizing!
- See Theme Asset Filters for examples.
- Automatic Asset Loading:
The plugin detects the current page type, template, or post type and loads the corresponding CSS/JS file. If no specific file is found, it falls back to
main.js/main.css. - Block Editor Features: Easily register and manage custom blocks, block categories, and block editor plugins. Use filters to control dependencies, localization, and more.
- Webpack Automation (Optional): Utilities help you keep your Webpack config in sync with your codebase, automatically generating entries and copying assets. You can use these utilities without using the PHP controllers.
- Inline Asset Registration:
Register critical CSS/JS for inline output in
wp_headorwp_footer. - Extensive Filters: Fine-tune every aspect of asset loading, block registration, and build output. See the docs for a full list.
- Theme Asset Loading →
- Block Editor Features →
- Webpack Automation →
- Inline Asset Registration →
- All Filters & Usage →
- Troubleshooting →
For a full list of filters, advanced configuration, and real-world usage, see the relevant sections in each doc in the /docs/ folder.