wp_enqueue_script not update my custom javascript code

Used WordPress:

Version 5.4


I have this code inside themes function.php:

function kopiKupon() {
   wp_enqueue_script( 'customjs', get_template_directory_uri() . '/assets/js/custom.js',array ('jquery'), '1.0',true );
wp_enqueue_style( 'custom', get_template_directory_uri() . '/assets/css/custom.css',false,'1.0','all');
add_action( 'wp_enqueue_scripts', 'kopiKupon' );

The problem is after i changing the custom.js code then upload it to server, the result is the new code is not applied


How to make the update code is working … ?


Just change the version to false or raise it after changing the code

 wp_enqueue_script( 'customjs', get_template_directory_uri() . '/assets/js/custom.js',array ('jquery'), false ,true );

or raise the version

 wp_enqueue_script( 'customjs', get_template_directory_uri() . '/assets/js/custom.js',array ('jquery'), '1.1',true );

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *