I want to remove jquery.min.js. because I don’t need it. For this, it is necessary not to use "wp_deregister_script".
I also added the theme’s js file manually.
<script type='text/javascript' src='http://site/wp-content/themes/mytema/js/scripts.js'></script>
but the js file of the theme does not work when I add it manually.
When I checked with Chrome, I saw the following error.
Uncaught ReferenceError: jQuery is not defined
https://sitet/wp-content/themes/mytema/js/scripts.js:1
There is no need for a reference. There is only one js file now. How can I fix this problem? thanks.
2
Answers
Perhaps above js script contains a code that uses the jquery object. I recommend that you check that part and use "wp_enqueue_script hook"f to insert the script.
https://developer.wordpress.org/reference/hooks/wp_enqueue_scripts/#:~:text=wp_enqueue_scripts%20is%20the%20proper%20hook,enqueuing%20both%20scripts%20and%20styles.
This is pretty simple. You have no any jquery file but in code wanted to use the jQuery object. Either you have to remove the code where contain the jQuery or you have to use the jquery.min.js.
And to manually enqueue the js file please follow this https://developer.wordpress.org/themes/basics/including-css-javascript/
Thank you