Let’s test our plugin to make sure everything works as expected. Open up your browser and go to the Console tab. Look for errors. If you find an asset not found error, you’ll need to explore why.
I found when testing that Yoast SEO has an admin stylesheet that has the version number as part of the filename. That causes a problem. Therefore, I added the enqueued handle to my configured list of assets to skip.
If you want the final code for this project, click here to view it on GitHub .
You did an awesome job doing this lab with me. Did you learn something new? Reach out and let me know what. Psst…I’m proud of you! Great job!
Assets, i.e. scripts, styles, and fonts, need a version number in order for them to bust through the web hosting cache and for users to receive the latest file(s). In this series of hands-on labs, we’ll take a look at versioning. Then we’ll dive into better asset versioning techniques to eliminate redundancy and manual processes, automate the versioning, improve your build efficiency, and take care of the ding we get on website speed testing sites, such as Pingdom. The Prerequisites Let’s get you ready to do this series to ensure you get the most out of it. The Series Hands-on […]
Check out the WordPress Fundamentals Library for more hands-on labs, insights, Docx, and more.
Check out the series page for more labs: Better Resource (Asset) Versioning Series
Break. Go rest your noodle for a couple of minutes.
Total Lab Runtime: 03:18:22
- 1 Lab Introductionfree 09:30
- 2 What is a URL Query String?free 14:36
- 3 The Intent of ?ver=1.0.0free 12:22
- 4 Understanding the Problemfree 14:01
- 5 Cache Busting Strategiesfree 09:57
- 6 Planning Our Pluginpro 18:17
- 7 Versioning Utility Helper Filepro 08:36
- 8 Start the URL Converter Classpro 18:11
- 9 Hook into WordPresspro 11:57
- 10 Regex or Parse the URL?pro 12:30
- 11 Convert with Regexpro 06:10
- 12 Apache and Nginx Rewrite Rulespro 10:43
- 13 Deciding Whether to Convertpro 07:35
- 14 Skip When No Version Query Stringpro 09:18
- 15 Only the Local Assetspro 14:09
- 16 Improving Our Code & Readabilitypro 11:52
- 17 Test, Fine-Tune, and Wrap it Uppro 08:38