jquery.js doesn’t load in the footer
-
By default, wpcf7 loads its scripts.js file in the footer, but jquery.js, which is a dependency, still gets loaded in the header. (WP still does this in 5.2.2.) The only way I’ve found to change this behaviour is to patch controller.php. Instead of using the ‘in_footer’ parameter of wp_enqueue_script(), I test wpcf7_load_js() and conditionally add wpcf_enqueue_scripts() to the ‘wp_head’ action instead of the ‘wp_enqueue_scripts’ action. wp_head comes too late for the script to be loaded in the header so it gets loaded in the footer, This seems to be the most reliable way to enqueue scripts in the footer, but it’s not very convenient as it means patching the plugin code. Could the developers look into this please?
- The topic ‘jquery.js doesn’t load in the footer’ is closed to new replies.