Responsive Adsense and WordPress

The problem

No ads show up when using the responsive code for Google Adsense in a WordPress 3.8.1 page or entry.

The solution

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Responsive -->
<ins
     style="display:block"
     data-ad-client="ca-pub-0000000000000000"
     data-ad-slot="0000000000"
     data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

Take the code presented by Google and remove all line breaks in it. In other words, make all the code be on a single line. Then paste it where you want ads on your web page. It’s WordPress’ wpautop function that doesn’t recognize the asynchronous Javascript and therefore adds formatting markup that breaks the code.

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><ins style="display:block" data-ad-client="ca-pub-0000000000000000" data-ad-slot="0000000000" data-ad-format="auto"></ins><script>(adsbygoogle = window.adsbygoogle || []).push({});</script>

Result