Prevent Version URL Parameter (?ver=X.X.X) on Enqueued Styles & Scripts

Question

Use Case

I’ve been experimenting with Chrome’s Dev Tools Workspace features. It includes the ability to edit a file directly in Dev Tools and have the saved stylesheet refresh itself (or even compile and then refresh!).

However, as documented in the StackOverflow question “Chrome’s “Auto-Reload Generated CSS” not reloading page when SASS recompiles CSS”, URL parameters on the stylesheet URL prevent Chrome from noticing the change.

Desired Outcome

That means that only during development, I wanted to remove the ?ver=X.X.X from the normal stylesheet <link> output by wp_enqueue_style(). In other words, I wanted the default href:

http://localhost/mysite/wp-includes/style.css?ver=4.1.1

to instead be this:

http://localhost/mysite/wp-includes/style.css
0
mrwweb 4 months 0 Answers 15 views 0

Leave an answer