Load scripts in the footer
-
This is most optimal performance wise. I also see a few inline scripts which is bad practice. If you need PHP generated data use wp_localize_script() which I see you’ve even used other places in the code.
I also see that you enqueue jQuery directly (
wp_enqueue_script("jquery");
). wp_register_script() has a dependency argument.wp_register_script( 'ws_js', plugins_url( 'js/webshipr.js', __FILE__ ), array( 'jquery' ), $ver, true );
The above would be optimal. The version parameter really is also needed for cache busting.
https://www.ads-software.com/plugins/webshipr-automated-shipping/
- The topic ‘Load scripts in the footer’ is closed to new replies.