Ask any question about WordPress here... and get an instant response.
How do I enqueue stylesheets properly in a WordPress theme?
Asked on Dec 09, 2025
Answer
Enqueuing stylesheets in a WordPress theme is essential for ensuring that styles are loaded correctly and in the right order. This is typically done in the theme's functions.php file using the wp_enqueue_style function.
<!-- BEGIN COPY / PASTE -->
function my_theme_enqueue_styles() {
wp_enqueue_style('my-theme-style', get_stylesheet_uri());
}
add_action('wp_enqueue_scripts', 'my_theme_enqueue_styles');
<!-- END COPY / PASTE -->Additional Comment:
- Use get_stylesheet_uri() to enqueue the main stylesheet of your theme.
- Always hook your function to wp_enqueue_scripts to ensure styles are loaded properly.
- Consider using versioning by adding a version number to your stylesheets for cache busting.
Recommended Links:
