Title: Eliminate render-blocking JavaScript
Last modified: August 31, 2016

---

# Eliminate render-blocking JavaScript

 *  [zubair.am](https://wordpress.org/support/users/zubairam/)
 * (@zubairam)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/eliminate-render-blocking-javascript-1/)
 * Hi,
 * I analyzed my site using Google PageSpeed Insights and got an error
 * Eliminate render-blocking JavaScript in above-the-fold content
 * JQuery was one of the package that Google was pointing to
 * I Googled and came upon some suggestions on how this can be done.
 * I followed the code given [here](http://www.oxhow.com/optimize-defer-javascript-wordpress/)
 *     ```
       function optimize_jquery() {
       if (!is_admin()) {
       wp_deregister_script('jquery');
       wp_deregister_script('jquery-migrate.min');
       wp_deregister_script('comment-reply.min');
       $protocol='http:';
       if($_SERVER['HTTPS']=='on') {
       $protocol='https:';
       }
       wp_register_script('jquery', $protocol.'//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js', false, '3.6', true);
   
       wp_enqueue_script('jquery');
       }
       }
       add_action('template_redirect', 'optimize_jquery');
       ```
   
 * While it did remove the JQuery extension from my WordPress’s include folder, 
   the code was still in the <head> tag and not in <body> as was expected.
 * I then came across [this info](http://blog.cloudfour.com/getting-all-javascript-into-the-footer-in-wordpress-not-so-fast-buster/)
   then which said that sometimes the wp_register_script() last argument of true
   doesnt necessarily set the code in footer, I followed the suggestion and added
   true to wp_enqueue_script() last argument, but still no luck.
 * What am I doing wrong here? How can I make this work and eliminate the render-
   blocking JavaScript.

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [10 years, 3 months ago](https://wordpress.org/support/topic/eliminate-render-blocking-javascript-1/#post-7301852)
 * Maybe it’s easier to use a plugin: [https://wordpress.org/plugins/scripts-to-footerphp/](https://wordpress.org/plugins/scripts-to-footerphp/)
 *  Thread Starter [zubair.am](https://wordpress.org/support/users/zubairam/)
 * (@zubairam)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/eliminate-render-blocking-javascript-1/#post-7301864)
 * Hi Andrew,
 * Using this plugin doesnt fix the issue. Even though the JS file is moved into
   the body tag, the Google page speed still throws an error.
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [10 years, 3 months ago](https://wordpress.org/support/topic/eliminate-render-blocking-javascript-1/#post-7301865)
 * Sounds like you’re not facing a render-blocking issue with JavaScript if you’ve
   moved your libraries into the footer.
 *  Thread Starter [zubair.am](https://wordpress.org/support/users/zubairam/)
 * (@zubairam)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/eliminate-render-blocking-javascript-1/#post-7301866)
 * On a side note, where can I test if JQuery was used by my site. I mean it will
   be downloaded somewhere right?
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [10 years, 3 months ago](https://wordpress.org/support/topic/eliminate-render-blocking-javascript-1/#post-7301868)
 * Look at the source code of your website and search for “jquery”

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Eliminate render-blocking JavaScript’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/eliminate-render-blocking-javascript-1/#post-7301868)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
