Created
September 5, 2019 12:17
-
-
Save Inzman/4b37ba375ec63d44ccacbcb5ffb64772 to your computer and use it in GitHub Desktop.
Wordpress - fix child CSS version cache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function _fix_child_css_version( $src ) { | |
| $parts = explode( '?', $src ); | |
| if ( stristr( $parts[0], '-child/style.css' ) ) { | |
| $child_ver = filemtime( get_stylesheet_directory() . '/style.css' ); | |
| return $parts[0] . '?v=' . $child_ver; | |
| } | |
| else { | |
| return $src; | |
| } | |
| } | |
| add_filter( 'style_loader_src', '_fix_child_css_version', 15, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment