Codex

Function Reference/antispambot

Contents

Description

Converts email addresses characters to HTML entities to block spam bots.

Usage

<?php antispambot$emailaddy$mailto ?>

Parameters

$emailaddy
(string) (required) Email address.
Default: None
$mailto
(integer) (optional) 0 or 1. Used for encoding.
Default: 0

Return Values

(string) 
Converted email address.

Examples

Default Usage

<?php
echo antispambot("john.doe@mysite.com");
?>

This will output the email like this in the HTML:

&#106;&#111;h&#110;&#46;&#100;&#111;&#101;&#64;mysit&#101;.&#99;&#111;&#109;

And in their browser, people will still see it right:

john.doe@mysite.com

Notes

Change Log

Since: 0.71

Source File

antispambot() is located in wp-includes/formatting.php.

Related

See also index of Function Reference and index of Template Tags.