# Adding WordPress' antispambot fuction to an email customizer field?

**URL:** <https://forum.pinegrow.com/t/adding-wordpress-antispambot-fuction-to-an-email-customizer-field/7705>\
**Category:** WordPress\
**Created:** [February 1, 2023, 4:07pm UTC](https://forum.pinegrow.com/t/adding-wordpress-antispambot-fuction-to-an-email-customizer-field/7705 "2023-02-01T16:07:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chipriggs](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/chipriggs/32/5076_2.png) [@chipriggs](https://forum.pinegrow.com/u/chipriggs)\
**Post date:** [February 1, 2023, 4:07pm UTC](https://forum.pinegrow.com/t/adding-wordpress-antispambot-fuction-to-an-email-customizer-field/7705/1 "2023-02-01T16:07:24Z")

</div>

Greetings Y’all!

I’m trying to figure out how to add WordPress’ antispambot function to an email customizer field to add a little obfuscation to the address and I’m a little perplexed at how to go about it.

It’d like to use this code:  
`<a href="mailto:<?php echo antispambot( 'farm@moonlightprairiefarm.com' ); ?>"><?php echo antispambot( 'farm@moonlightprairiefarm.com' ); ?></a>`

Which will be utilizing [this WP function](https://developer.wordpress.org/reference/functions/antispambot/).

The current setup I’m using in the footer looks like this:

 ![Screen Shot 2023-02-01 at 10.59.57 AM](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/9/9fbe7fba5a00762eca7024effa6f0731bcbd24ac.png)

I could could probably hard code it in with a PHP Code action but keeping the field & link editable through the customizer would be preferred. Any advice and direction would be much appreciated. Thanks!

---

<div class="post-metadata">

**Author:** ![jonroc](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/jonroc/32/2805_2.png) [@jonroc](https://forum.pinegrow.com/u/jonroc)\
**Post date:** [February 2, 2023, 2:39pm UTC](https://forum.pinegrow.com/t/adding-wordpress-antispambot-fuction-to-an-email-customizer-field/7705/2 "2023-02-02T14:39:08Z")

</div>

Before switching to FSE I always created my customizer fields in a one area (for me it was in my master.html page) and I never used the created version of it as an output. I always created a duplicate of the customizer field and use the “Don’t create the control, just display it” anytime I wanted to output it.

In your case, you can do the same. Create the control on a page that does not get exported to your theme (just to have its functionality) and then when you go to use your custom version of it, check the box I mentioned above and grab the PHP it will output (by using the \</\> icon top right of action). Then paste that PHP into a PHP function WP action and modify it with your antispambot() function around the output of the email address.

---

<div class="post-metadata">

**Author:** ![chipriggs](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/chipriggs/32/5076_2.png) [@chipriggs](https://forum.pinegrow.com/u/chipriggs)\
**Post date:** [February 2, 2023, 2:59pm UTC](https://forum.pinegrow.com/t/adding-wordpress-antispambot-fuction-to-an-email-customizer-field/7705/3 "2023-02-02T14:59:38Z")

</div>

@jonroc Awesome! Thanks for the direction, I’ll give this a go.

I spent a couple hours again this morning trying out different approaches but didn’t hit anything that seemed to work so I appreciate this immensely.
