Title: ReferenceError
Last modified: August 12, 2019

---

# ReferenceError

 *  [Natalya](https://wordpress.org/support/users/nalitana/)
 * (@nalitana)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/referenceerror-4/)
 * Hello! Why might the error “ReferenceError: jQuery is not defined” appear? The
   line is “jQuery (document) .ready (function ($)”.
 *     ```
       <script >              
       jQuery(document).ready( function($) {    
           if ($('#adsforwp-hidden-block').length == 0 ) {
           $.getScript("https://site.ru/front.js");
           }
   
       });
       </script>
       ```
   
 * And another question, if I connect the ad code only for AMP pages or only on 
   certain pages, how can I remove the plugin script output on all other pages where
   there are no ad units ?

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

 *  Thread Starter [Natalya](https://wordpress.org/support/users/nalitana/)
 * (@nalitana)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/referenceerror-4/#post-11829688)
 * Hello again! I understood why the error, because all the scripts in the subject
   are connected in the footer. Is there any way to transfer this script to the 
   footer as well? Thank!
 *  Plugin Author [Magazine3](https://wordpress.org/support/users/magazine3/)
 * (@magazine3)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/referenceerror-4/#post-11840509)
 * Can you share the URL so that I can see where the code loads and the reason for
   it?
 * So that I can understand and help you.
 *  Thread Starter [Natalya](https://wordpress.org/support/users/nalitana/)
 * (@nalitana)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/referenceerror-4/#post-11844916)
 * Hello! Have a nice day! The reason is that the connection of all scripts, including
   jquery.js, has been transferred to the footer. A plugin script is connected before
   jquery.
 *     ```
       function remove_head_scripts() {
       remove_action('wp_head', 'wp_print_scripts');
       remove_action('wp_head', 'wp_print_head_scripts', 9);
       remove_action('wp_head', 'wp_enqueue_scripts', 1);
   
       add_action('wp_footer', 'wp_print_scripts', 5);
       add_action('wp_footer', 'wp_enqueue_scripts', 5);
       add_action('wp_footer', 'wp_print_head_scripts', 5);
       }
       add_action( 'wp_enqueue_scripts', 'remove_head_scripts' );
       ```
   
 *  Plugin Author [Magazine3](https://wordpress.org/support/users/magazine3/)
 * (@magazine3)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/referenceerror-4/#post-11849560)
 * So you want to move the .js file to the footer, right?
 * Which file of ours do you want to move to footer?

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

The topic ‘ReferenceError’ is closed to new replies.

 * ![](https://ps.w.org/ads-for-wp/assets/icon-256x256.png?rev=1919470)
 * [Easy Google Adsense and Banner Ads Manager - AdsforWP](https://wordpress.org/plugins/ads-for-wp/)
 * [Support Threads](https://wordpress.org/support/plugin/ads-for-wp/)
 * [Active Topics](https://wordpress.org/support/plugin/ads-for-wp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ads-for-wp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ads-for-wp/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Magazine3](https://wordpress.org/support/users/magazine3/)
 * Last activity: [6 years, 9 months ago](https://wordpress.org/support/topic/referenceerror-4/#post-11849560)
 * Status: not resolved