jess888 Posted June 26, 2017 Share Posted June 26, 2017 I know very little about php; would love some help on a small task: I want to add a function to my WP websites so that all email addresses are encoded to prevent spammers from getting them. I understand that I can add this to my theme functions: <?php antispambot('protectmy@email.com') ?> I can get into the functions.php page of my child theme via the Editor, which says: <?php /** * @package Make Child * * Add your custom functions here. */ But when I add the spambot function to the end of this code, the site crashes, so I know my syntax must be wrong. Thank you in advance.... Quote Link to comment Share on other sites More sharing options...
maxxd Posted June 27, 2017 Share Posted June 27, 2017 I've not used this function (in fact, didn't even know it existed until now), but according to the codex the antispambot() function will output the email address so you need to hook it into a widget or shortcode output function, not just drop it into the functions.php file. Also, the function will only obfuscate the address(es) passed to it, so it's not going to be a situation where you add the code and all email addresses throughout the site are handled. Quote Link to comment Share on other sites More sharing options...
jess888 Posted June 27, 2017 Author Share Posted June 27, 2017 I've not used this function (in fact, didn't even know it existed until now), but according to the codex the antispambot() function will output the email address so you need to hook it into a widget or shortcode output function, not just drop it into the functions.php file. Also, the function will only obfuscate the address(es) passed to it, so it's not going to be a situation where you add the code and all email addresses throughout the site are handled. Thank you so much. I will use a plugin, I think. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.