Title: Adsense Code Not Working
Last modified: July 3, 2020

---

# Adsense Code Not Working

 *  Resolved [jloram](https://wordpress.org/support/users/jloram/)
 * (@jloram)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/adsense-code-not-working-3/)
 * Hey!
 * Just getting to know this awesome plugin. I added my adsense code, which looks
   like this:
 * <script async src=”[https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script&gt](https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script&gt);
   
   <!– OC Trivia HD Quiz Ads –> <ins class=”adsbygoogle” style=”display:block” Just
   a sample above for visual…
 * But when I save, it turns into this?!?
 * %3Cscript+async+src%3D%5C%22https%3A%2F%2Fpagead2.googlesyndication.com%2Fpagead%
   2Fjs%2Fadsbygoogle.js%5C%22%3E%3C%2Fscript%3E%0D%0A%3C%21–+OC+Trivia+HD+Quiz+
   Ads+–%3E%0D%0A%3Cins+class%3D%5C%22adsbygoogle%5C%22%0D%0A+++++style%3D%5C%22display%
   3Ablock%5C%22%0D%0A+++++data-ad-client%3D%5C%22ca-pub-
 * Obviously, this is NOT working on my quizzes. Any ideas?

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

 *  Plugin Author [Harmonic Design](https://wordpress.org/support/users/harmonic_design/)
 * (@harmonic_design)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/adsense-code-not-working-3/#post-13069946)
 * Hi jloram,
    I’ll save you from the explanation on why this happens, but the adcode
   _will_ despite showing the character encoding after saving.
 * Basically, paste in the full code and save. This WILL correctly save as long 
   as you pasted in correct code. However, please note that when the page refreshes,
   it will look like your second example (if you reload the page again, it will 
   display correctly again – this is done for an extra layer of security). Because
   of this, if you were to save again with the escaped version in the textarea, 
   then instead of the original and correct code, the ‘html escaped’ version you
   are seeing will overwrite it.
 * TLDR; Just paste in the correct code and save once and you should be good to 
   go.
 * Please let me know if you need further help with this
 *  Thread Starter [jloram](https://wordpress.org/support/users/jloram/)
 * (@jloram)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/adsense-code-not-working-3/#post-13069991)
 * Hey thanks for the FAST response! Another question along the same lines…
 * I’m set for each question to open on it’s own page, how are ads treated in this
   instance? Will it show an ad instead of question 6 then go to question 6 after
   the ad?
 * I also have my time set for 20 seconds per question.
 *  Plugin Author [Harmonic Design](https://wordpress.org/support/users/harmonic_design/)
 * (@harmonic_design)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/adsense-code-not-working-3/#post-13070019)
 * The ads are meant to be displayed in the loop – so when multiple questions are
   on the same page. Like a lot of features, the ads from this “feature” are not
   compatible with the WP pagination feature if you have it set to less than 6.
 * I recommend disabling WP Pagination and to instead use the pagination feature
   on each individual question. This will make it so that all questions are on one
   page, but only one question appears at a time. This is fully compatible with 
   all HD Quiz features and will run your ad code after ever 5th question (note:
   Adsense has a feature where Google chooses where to show the ad, so that would
   obviously override every 5th question placement).
 * However, if you really want to use WP Pagination, then I would recommend adding
   your adcode directly to your theme, or to use HD Quizzes `hdq_before` hook to
   add the code for only pages where ads show.
 * For example, if you add the following code to your theme’s `functions.php` file,
   then the ad code will be added just before the quiz on each page.
 *     ```
       function hdq_before_jloram($quizID)
       {
       ?>
   
       <!-- paste your ad code here -->
   
       <?php
       }
       add_action("hdq_before", "hdq_before_jloram");
       ```
   
 *  Thread Starter [jloram](https://wordpress.org/support/users/jloram/)
 * (@jloram)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/adsense-code-not-working-3/#post-13070038)
 * Outstanding, thank you. I think this is going to be the perfect tool for my needs.
   Can’t wait to review and send you some good ol’ US dollars. BTW, belated Happy
   Canada Day wishes!
 *  Thread Starter [jloram](https://wordpress.org/support/users/jloram/)
 * (@jloram)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/adsense-code-not-working-3/#post-13070042)
 * Oh, and I believe that’s how I have mine set up. I’ve left the WP Pagination 
   blank and I ticked for each question to appear on it’s own page. Is this correct?
 *  Plugin Author [Harmonic Design](https://wordpress.org/support/users/harmonic_design/)
 * (@harmonic_design)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/adsense-code-not-working-3/#post-13070248)
 * Sounds like you have it right 🙂
 * Thank you for the Canada Day wishes. You have a great time tomorrow as well!

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

The topic ‘Adsense Code Not Working’ is closed to new replies.

 * ![](https://ps.w.org/hd-quiz/assets/icon-256X256.gif?rev=2936040)
 * [HD Quiz](https://wordpress.org/plugins/hd-quiz/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/hd-quiz/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/hd-quiz/)
 * [Active Topics](https://wordpress.org/support/plugin/hd-quiz/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/hd-quiz/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/hd-quiz/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Harmonic Design](https://wordpress.org/support/users/harmonic_design/)
 * Last activity: [5 years, 10 months ago](https://wordpress.org/support/topic/adsense-code-not-working-3/#post-13070248)
 * Status: resolved