Title: Looking for some help with simple code
Last modified: January 16, 2021

---

# Looking for some help with simple code

 *  [andrejen](https://wordpress.org/support/users/andrejen/)
 * (@andrejen)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/looking-for-some-help-with-simple-code/)
 * Hi everyone. I run a real estate website and the real-estate theme I use gives
   you the option to include a “common-note”, basically a message that appears on
   all of the properties you have on the site. You can edit the common note text
   and title in the customiser.
    Basically, I wanted to paste some adsense code 
   into the common note so that ads would appear on all the properties. However,
   it seemed that the common note box in the customiser wouldn’t accept HTML. So
   I emailed support asking how to sort this out and they instructed me to remove
   the esc_html() from here. – [https://tppr.me/E24yo](https://tppr.me/E24yo) .
 * Well I tried doing that and it still didn’t work. However (apologies) I don’t
   know anything about code so I’m not sure if I removed what I was supposed to.
   [This](https://imgur.com/a/sXdh7D6) is how I followed his instructions however
   it didn’t work as you can see in the screenshot above.
 * What exactly am I doing wrong?
 * If it helps, I try to paste in the adsense code into the customiser and click
   publish, once I refresh it, all the adsense code in the box is gone and it’s 
   just left with (adsbygoogle = window.adsbygoogle || []).push({});
 * Hopefully this is enough info, thanks to everyone who can help!
    -  This topic was modified 5 years, 4 months ago by [andrejen](https://wordpress.org/support/users/andrejen/).

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/looking-for-some-help-with-simple-code/#post-13919113)
 * Some other code is sanitizing your adsense code. The point of sanitation is largely
   to prevent malicious code from sneaking in. Sanitation code for textual content
   doesn’t distinguish legitimate from malicious. It assumes any code is bad. Theme
   support is going to need to dig deeper to prevent all sanitation. It’s not something
   we can help you with here.
 * TBH, this is really the wrong approach. Disabling sanitation introduces greater
   security risk. Generally speaking, code (except shortcode) does not belong in
   any WP content. Code like this is normally placed on an appropriate template 
   file or inserted into output through some sort of filter hook.
 * What you could do is add code to output the adsense code right in the theme’s
   common note code. First restore the esc_html() code. Remove your adsense code
   from your common note. Add something like the following immediately below the
   line with esc_html():
    `echo '<script>/* Your adsense code goes here */</script
   >';`
 * If your adsense code already has its own `<script>` tags, don’t use the ones 
   shown above. Also mind any single quote usage in the code. Any that occur need
   to be escaped with a backslash (`\'`)to distinguish them from those used in PHP
   to demarcate what is to be echoed out.
 * If your theme is subject to periodic updates, directly altering theme files like
   this is not advised. We normally recommend the use of a child theme to contain
   altered code. Overriding a theme function declaration can get rather involved
   though. Ideally the function would have filtered its output so you can easily
   alter the output without having to alter the underlying code.

Viewing 1 replies (of 1 total)

The topic ‘Looking for some help with simple code’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/looking-for-some-help-with-simple-code/#post-13919113)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
