Community Forums › Forums › Archived Forums › General Discussion › Style.css?ver= Not showing updates
Tagged: style.css
- This topic has 3 replies, 2 voices, and was last updated 8 years, 2 months ago by
Victor Font.
-
AuthorPosts
-
January 23, 2017 at 4:41 pm #199898
scaught
MemberHi, all.
This is a common problem for many developers. . .just not sure of the most elegant fix.
When updating the style.css file, changes are not reflected in the browser. This is because the child theme I'm using (Infinity Pro) is adding a "ver=x.x.x" to the end of the style.css link:
<link rel='stylesheet' id='infinity-pro-css' href='http://websitehere.com/wp-content/themes/infinity-pro/style.css?ver=1.1.0' type='text/css' media='all' />
What causes the addition of the "ver=1.1.0"? How do I change it or, preferably, remove it alltogether. (Other Studiopress themes we've used do not add the "ver=" code, yes some do.)
TIA,
-- Scott
January 23, 2017 at 5:47 pm #199899Victor Font
ModeratorNear the top of functions.php you should see define( 'CHILD_THEME_VERSION', '1.1.0' );. This is used for the ver tag. Bump up this number if you want the tag to change.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?January 23, 2017 at 6:27 pm #199904scaught
MemberThanks!
When you mean "bump it up", do you mean increase the number? How will that help the delay between style.css edits and the browser reflecting the changes? Can I just get rid of the whole thing?
January 24, 2017 at 12:06 am #199912Victor Font
ModeratorBy bump up, I mean increase the version number. A delay occurs between editing style.css and seeing the changes displayed in the browser primarily due to caching, whether the caching occurs on the server or on the client with the browser cache. If you use a caching plugin in WordPress, or your host offers caching like SiteGround does, it only compounds the delays. When I am developing a website or making changes to CSS, I make sure all WordPress and server level caching are turned off while I am working.
Regardless of whether you use a WordPress cache plugin or have server caching, when you load a web page, all the files associated with that page are also cached on the local computer by the browser. This includes the style sheet. A complete copy of the style sheet is copied from your web site and stored on the local computer. This allows the browser to load it faster the next time it needs it rather than making a trip back to your server to retrieve it again.
If the browser determines that a web page is trying to load a style sheet with the same version number as the the one it already has stored locally, it will use the local version. Of course, the changes you made are on your server, but since the version number hasn't changed, the browser won't pick those changes up because the file is not downloaded again. There are two ways to correct this, you can either bump up the version number so the browser sees the file as a different version, or you can hold the shift key down when you refresh the page in your browser. Holding the shift key down forces the browser to reload the style sheet from the server regardless of the version number.
Can you get rid of it? Yes, of course you can. This will help: https://victorfont.com/remove-wordpress-script-query-strings/
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet? -
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.