Last active
December 17, 2020 09:41
-
-
Save FutureMedia/ef07b014b9cb8a0e4c400d077e70f9db to your computer and use it in GitHub Desktop.
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
<?php | |
// | |
// | |
function set_custom_ver_css_js( $src ) { | |
// style.css URI | |
$style_file = get_stylesheet_directory().'/style.css'; | |
if ( $style_file ) { | |
// css file timestamp | |
$version = filemtime($style_file); | |
if ( strpos( $src, 'ver=' ) ) | |
// use the WP function add_query_arg() | |
// to set the ver parameter in | |
$src = add_query_arg( 'ver', $version, $src ); | |
return esc_url( $src ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment