Force reload of scrips and stylesheets – something wrong with the code


I’m trying to force reload of scripts and stylesheets in plugins and themes. I’m trying to achieve this with the following code:

function version_id() {
  if ( WP_DEBUG )
    return time();
  return VERSION;

wp_enqueue_script( 'my_script', 'my_script.js', '', version_id() );
wp_enqueue_style( 'my_style', 'my_style.css', '', version_id() );

When I apply this to my WordPress website, it starts loading to infinite. What am I doing wrong? I think this code should do the trick.

kacper3355 4 months 0 Answers 15 views 0

Leave an answer