diff --git a/class-local-scripts-shortcode.php b/class-local-scripts-shortcode.php index edd9f7f..7176570 100644 --- a/class-local-scripts-shortcode.php +++ b/class-local-scripts-shortcode.php @@ -58,8 +58,10 @@ public static function local_script( $attr ) { $full_path = get_site_url( 1, '/wp-content/themes/' . basename( get_template_directory() ) ) . '/' . $path . '/' . $script; $full_path = esc_attr($full_path); } + + $version_path = get_theme_file_path( $path . '/' . $script . '.js' ); - wp_enqueue_script( str_replace('/', '_', $full_path ), esc_attr($full_path . '.js'), $attr['dependencies'], false, true ); + wp_enqueue_script( str_replace('/', '_', $full_path ), esc_attr($full_path . '.js'), $attr['dependencies'], filemtime($version_path), true ); return ''; }