I want to edit the JS file, however, any cahnges that I make do not appear on website.

I added a simple:

console.log("hello world");

When looking at the head of the document, I can find the .js file:


When looking into the file, I cannnot see my change, however, when removing the ?ver=4.9.8 from the js URL I can see my code.

How can I regenerate this?

Sorry, I'm novice in regards to WP.

3 Answers 3


You have to look through your theme to see where the js file is enqueued. Usually there is a functions.php file in the theme which will have all the special functions and actions. Sometimes the developer will put all the enqueued scripts into the theme template (i.e. single.php) before get_header() is called.

In any event, your menu.js file is enqueued using the wp_enqueue_script() function either in the template file or functions.php. The 4th argument in this function can be set to a '1.0' type string to bust the cache when you make changes to the base js. If the call to wp_enqueue_script() does not specify a version in the 4th argument, WP will use the current version of WordPress running as the ver variable in the URL.

As a good practice, I would recommend using a child theme or a separate js file that hooks into the wp_enqueue_scripts hook because if you are subscribed to getting updates from the theme developer, your changes to functions.php will likely be overwritten. This might be a lot as you stated you are a WP novice but if you're going to stay with the platform, I think finding out about child themes, actions and hooks is worthwhile.

  • Thanks for the answer. You are correct it was the wp_enqueue_script(), I created a child theme and inherited the content of parent theme adding my own .js file and adding it to the queue.
    – Greg
    Oct 16, 2018 at 9:51

You seem to be getting a cached version of your JS file. Check if you have a caching plugin installed on your website, make sure you empty your browser cache, or contact your hosting provider to check if it's on their end.


A bit late, but you can use:

filemtime( plugin_dir_path( __FILE__ ) . 'css/myFunky.css or js/myFunky.js' ) 

to generate the version from the timestamp of the file. Each change will update the version automatically and WordPress will never use a cached version of the file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.