Custom JS script not loading into page?
-
This is inside my functions.php:
function load_utils() {
// Load constants.js first
wp_enqueue_script(
'utils',
get_stylesheet_directory_uri() . '/js/utils.js',
array(),
time(),
true
);
}
add_action('wp_enqueue_scripts', 'load_utils');I swear to god it’s not getting loaded into the page. Or better, when I check the “Network” section while inspecting the page, there is an utils.js loaded but it’s empty (or contains only auto generated code). The directory path of the script is right, as I have another script that is loading correctly, using this code here:
function my_custom_script() {
wp_enqueue_script(
'move_cat',
get_stylesheet_directory_uri() . '/js/move_cat.js',
array('utils'),
filemtime(get_stylesheet_directory() . '/js/move_cat.js'),
true
);
}
add_action('wp_enqueue_scripts', 'my_custom_script');This second script reflects the changes I’m doing on visual studio very quick.
What is the problem? caching? Thank you so much for your help
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
You must be logged in to reply to this topic.