Skip to content

Instantly share code, notes, and snippets.

@robertuniqid
Last active August 20, 2017 11:17
Show Gist options
  • Save robertuniqid/58a167a9d81abba20e5caa44be44c13a to your computer and use it in GitHub Desktop.
Save robertuniqid/58a167a9d81abba20e5caa44be44c13a to your computer and use it in GitHub Desktop.
WPEP - Force Assets Refresh in the Admin by JS.
<?php
add_action( 'admin_footer', function() {
echo '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery( "#wpep-admin-style-css" ).each( function() {
var hrefAttribute = jQuery(this).attr("href");
hrefAttribute += ( hrefAttribute.indexOf("?") === -1 ? "?" : "&" ) + "wpep-forced-refresh=" + "' . date("Y-m-d" ) . '";
jQuery(this).attr( "href", hrefAttribute );
});
});
</script>';
}, 5000 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment