Actually, using a hard-coded version in the parent theme is intentional and the correct approach. By keeping a fixed version, the parent stylesheet isn’t reloaded unnecessarily every time the site loads, which improves caching and performance. The version only needs to change when the parent theme itself is updated, not every time a child theme changes its CSS.
The child theme CSS always loads after the parent CSS, so it will override parent styles as long as the selectors are equal or more specific. If a child theme style seems not to apply, it’s usually due to selector specificity, not the hard-coded version. In that case, the child theme can simply increase selector specificity or use standard overriding methods to ensure its styles take precedence.
In short, the hard-coded version is not a problem, it’s proper caching behavior, and the child theme works correctly on top of it.
Hello Masood,
The correct approach is to enqueue styles with a constant version, not hard-coded.
A hard-coded version results in the following at the front-end (using Sydney child theme):
...
<link rel='stylesheet' id='parent-style-css' href='https://fayza.co.uk/wp-content/themes/sydney/style.css?ver=6.8.2' type='text/css' media='all' />
<link rel='stylesheet' id='sydney-google-fonts-css' href='https://fayza.co.uk/wp-content/fonts/26e17d00d2b4a5b68937946aaa007f7e.css?ver=20250902' type='text/css' media='all' />
<link rel='stylesheet' id='sydney-style-css' href='https://fayza.co.uk/wp-content/themes/mh-webdesign/style.css?ver=20230821' type='text/css' media='all' />
...
- In the first line
The parent styling is loaded through the child theme.
The child theme doesn’t pass any version argument while enqueuing the styles, thus the current WordPress version is used
- The second line
A font styling is enqueued by the parent theme
A hard-coded version "20250902" is passed, but it isn’t a problem here
- The third line
The child theme styling is loaded using the parent’s theme functions.php
A hard-coded version "20230821" is passed while enqueuing, which creates the caching problem when I updated the child theme or change the style.css file.
Wasn’t changed/updated since Sydney 2.26
Using a hard-coded version defies the main reason we use child themes; to be able to customize the theme and style.css without being overridden by the parent theme or its updates.
My solution suggests a constant version as a long as the currently active theme isn’t updated, either Sydney itself or the child theme.
Regards,
Hi Mahmoud Hossam,
When Sydney releases a new version, they update both the CSS content and the version number in functions.php (if the CSS is updated), so the hard-coded version always reflects the actual file state, this method ensures proper caching and works well.
Managing separate versions for each file can feel a bit tedious, but from a technical standpoint, it’s the right approach, stylesheets should only reload when they’ve actually been updated.
Regards,
Masood
Hi @moodyhosam,
Thank you for bringing this issue to our attention.
We have discussed the issue internally and we agree with your suggestion of removing the hard coded value. We have noted this down internally and we’ll be addressing this in a future theme update.
I hope this helps. Please let me know if you have other questions.
Thank you!
This is good news, thank you @kmacharia & @masoodmohamed!
I am going to mark it as resolved and I will be waiting for your next update.
-
This reply was modified 8 months, 2 weeks ago by
Mahmoud Hossam. Reason: bad american accesnt 😜