Skip to content

Instantly share code, notes, and snippets.

@maniaks
Created June 30, 2014 13:01
Show Gist options
  • Save maniaks/40fc93e64d73ca98999f to your computer and use it in GitHub Desktop.
Save maniaks/40fc93e64d73ca98999f to your computer and use it in GitHub Desktop.
Anti spam bot for WordPress
// Antispambot
// From http://www.guylabbe.ca/blog/wp-antispambot.html
function asb($content){
return preg_replace('/([_a-zA-Z0-9.\-]*@[a-zA-Z0-9]([_a-zA-Z0-9\-]+\.)+[a-zA-Z]{2,10})/e',"antispambot('\\1')",$content);
}
add_filter('the_content','asb');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment