Home » Functions » antispambot

The antispambot function is a WordPress function used to protect email addresses from being collected by spambots or email harvesters. This function takes an email address as an argument and returns an encoded version of the email address that can be displayed on a web page without being detected by spam bots.

The antispambot function works by converting the "@" symbol to the string " [at] " and the "." symbol to " [dot] " in the email address string. This makes it difficult for spambots to recognize the email address and collect it for spamming purposes.

Here is an example usage code:

    $email = '';
    $encoded_email = antispambot($email);
    echo 'Protected email: ' . $encoded_email;

In the code above, the email address "" is passed as an argument to the antispambot function. The function then returns the encoded version of the email address, which is stored in the $encoded_email variable. Finally, the encoded email is displayed on the webpage using the echo statement.

Note that the antispambot function can be used in combination with other email protection techniques, such as using a contact form or displaying the email address as an image.

Learn More on

Register an account to save your snippets or go Pro to get more features.