Hi all I have some trouble with a WordPress website.
I’m changing the way the scripts are loaded on the website (async vs sync) and doing some purge to useless scripts (multiple versions of jquery etc. etc.).
Some of them were loaded plain and simple on the header (header.php) and i have moved them already, some of the others are loaded with a function called wp_head();
This function loads a lot of stuff (scripts and plain text javascript) but i can’t find where it is…
i read there
How to find HTML rendered by <?php wp_head(); ?> in WordPress?
that there are many function hooked to this one by, for instace, plugins and more but how it is possible to find them all?
Anyone can help me?
Thanks
Usually scripts are hooked in the
wp_enqueue_scripts
hook that is hooked inwp_head
.I mean usually because not every developer follows the guidelines.
You can check the functions hooked in
wp_enqueue_scripts
using this functions, that @Rarst createdPut this in your functions.php:
and call it like this:
list_hooks( 'wp_enqueue_scripts' );
I really recommend to do this in a development environment.
This will return a list of functions hooked in the
wp_enqueue_scripts
hook.To know more about the functions check the post Debug WordPress hooks.