Created
June 23, 2016 12:52
-
-
Save jopfre/ffd0153015a791ee25dc14e6cec825f6 to your computer and use it in GitHub Desktop.
Add Timestamp to WordPress Child Theme Stylesheet to invalidate cache
This file contains 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 add_timestamp_to_childtheme_stylesheet() { | |
wp_dequeue_style( 'style' ); | |
wp_deregister_style( 'style' ); | |
wp_enqueue_style('style', get_stylesheet_uri().'?'.filemtime(get_stylesheet_directory().'/style.css'), array(), null); | |
} | |
add_action( 'wp_print_styles', 'add_timestamp_to_childtheme_stylesheet' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment