Jump to content


This topic is now archived and is closed to further replies.


Saving google adsense code in php variable for reuse throughout site?

Recommended Posts

I have a Google Adsense code that I am saving to the wp_options table. I can successfully save and retrieve the variable containing the google adsense code but it doesn't do anything except display it as plain text on screen.
How can I make this html/javascript in the variable actually load in page as HTML/JS instead of as plain text???
this is the example of the code that I'm saving to the database and retrieving....
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- EggSquat main banner ad -->
<ins class="adsbygoogle"
(adsbygoogle = window.adsbygoogle || []).push({});




may I should make a custom post type and just display a post, and use that instead of a single field saving to database

Share this post

Link to post
Share on other sites

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.