cache – Add version to wp_register_style function


I have seen many articles adding a version number to a stylesheet, but as I have found out there are also many ways to accomplish the same goal with PHP.

I have a function in which I am wanting to register a stylesheet. The function works properly but I am not sure how to add a version number to the stylesheet for cache busting purposes with my specific line of code.

I have checked wordpress codex but their wp register style function looks different than mine and I don’t want to break anything.

Here is mine

wp_register_style( 'customStyles', plugins_url( 'css/custom-styles.css', __FILE__ ) );

Here is WordPress codexs’

wp_register_style( string $handle, string|bool $src, string[] $deps = array(), string|bool|null $ver = false, string $media="all" )

How do I add a version number?

bagarangmeetsruffio 1 year 2021-11-28T22:17:10-05:00 0 Answers 0 views 0

Leave an answer