Answer the question
In order to leave comments, you need to log in
Why is wp_enqueue_script needed if it's slow?
Here everywhere they write like connect scripts in a direct way like
<script src="/scripts/jquery-3.3.1.min.js"></script>
not right. wp_enqueue_script( 'jquery-3.3.1', '/scripts/jquery-3.3.1.min.js', array(), '1.0', false);
Answer the question
In order to leave comments, you need to log in
This is not advice, this is the right way. If you connect in a direct way, then such scripts / styles will not be able to take into account and, if necessary, process other plugins. Conflicts can also arise when you have a bunch of versions of jquery or another library.
When connecting via wp_enqueue_script, you can flexibly manage dependencies, prescribe the script loading/disabling logic as you like. Plugins can work with such scripts. Merge into one file, for example.
And the fact that your site takes longer to load is hosting problems or your inability to localize the problem.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question