0

I am adding a javascript file through the functions.php file. I am using the method as suggested on Wordpress Codex. One question I have is that what is the best way to handle the version number column. Is it recommended to send the version of jquery or the version of the script I am loading? Using this code.

<?php
function my_scripts_method() {
// register your script location, dependencies and version
   wp_register_script('custom_script',
   get_template_directory_uri() . '/js/custom_script.js',
   array('jquery'),
   '1.0' );
 // enqueue the script
  wp_enqueue_script('custom_script');
  }
add_action('wp_enqueue_scripts', 'my_scripts_method');
?>

1 Answer 1

0

The version is the version of your own script, and is appended to the filename in the src attribute of the script tag. This is so you can employ long-term caching on the client-side and still insure a new version of your script will be fetched from the server rather than local cache if you update it.

1
  • Just what I neded Commented Jan 4, 2012 at 18:29

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.