
Now when I change that to Version: 4.1 I get style.css?cache-bust=0. However other options such as version is what wp_enqueue_style's version boolean gives reference too. Within your style.css you must name your theme. However setting it to true allows the stylesheet's declared version to cache bust the stylesheet. I could not get a version number in wp_enqueue_style to trigger a query param like ?ver=1.2.3 on my stylesheet. Default value:īut it is very cryptic as to how it actually works. Version number is automatically added equal to current installed Version number, if it has one, which is added to the URL as a query $ver (string|bool|null) (Optional) String specifying stylesheet Enqueue multiple CSS files or Style file in WordPress Theme To enqueue multiple CSS files, you can keep them within a function and enqueue them by WordPress hook. css reset, which style.css would overwrite. Remember: Don’t forget to change the name & path of the css file. css file before style.css is loaded Or make the default style.css dependant on another. Both the wpenqueuescript and wpenqueuestyle functions have parameters for version number. To enqueue CSS or style file in WordPress theme, add the below code in your theme’s functions.php file. I didn't get much out of these answers so I thought I'd write what worked for me. Hopefully, you’re using WordPress enqueue functions to load your scripts and styles. If you don't want the version to dynamically change every time you can simply do this: wp_enqueue_style( 'main_style', get_stylesheet_directory_uri(). '/style.css', '', $style_ver ) Īs you can see, this code gets the last modified time of style.css file using filemtime() PHP function and it also converts the time to timestamp using time() PHP function just to make things clean. Wp_enqueue_style( 'main_style', get_stylesheet_directory_uri(). $style_ver = filemtime( get_stylesheet_directory().
Wp enqueue style css wordpress update#
You need to update this code for version. Now that you found the code and you know that your theme adds this stylesheet by using wp_enqueue_style() in functions.php file. if the ID is: main_style-css search for just main-style in your functions.php file, and you should probably find the line of code you were looking for. You can search for the ID (except for -css part).

Or Like: wp_enqueue_style( 'twentysixteen-style', get_stylesheet_uri() )

Open your wp-content/themes/YOUR_THEME_NAME/functions.php file, and find out the line which is adding the style sheet, Like: wp_enqueue_style('main_style', get_stylesheet_directory_uri().
Wp enqueue style css wordpress how to#
Here is how to find out if your theme does the same. Mostly theme's use wp_enqueue_style() function inside their functions.php file to add style sheet in the header.
