Skip to content

Instantly share code, notes, and snippets.

@stefanmm
Created September 25, 2022 10:06
Show Gist options
  • Save stefanmm/4f03a17c4999e966e0553a884ff26dcd to your computer and use it in GitHub Desktop.
Save stefanmm/4f03a17c4999e966e0553a884ff26dcd to your computer and use it in GitHub Desktop.
WP enqueue scripts, ignore caching
<?php
// Enqueue JS and CSS
function enqueue_scripts_44587912556() {
$js_ver_stamp = filemtime( plugin_dir_path( __FILE__ ) . 'js/scripts.js' ); // Get timestamp of the file
$css_ver_stamp = filemtime( plugin_dir_path( __FILE__ ) . 'css/styles.js' ); // Get timestamp of the file
wp_enqueue_script('my_scripts', plugins_url( 'js/scripts.js', __FILE__ ), array(), $js_ver_stamp); // Append timestamp of the file
wp_register_style('my_styles', plugins_url( 'css/styles.css', __FILE__ ), false, $css_ver_stamp); // Append timestamp of the file
wp_enqueue_style ('my_styles');
}
add_action('wp_enqueue_scripts', 'enqueue_scripts_44587912556');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment