Last active
April 11, 2019 07:06
-
-
Save WordPress-Handbuch/00473433c2f4a2c9b5de40b74ec5096a to your computer and use it in GitHub Desktop.
Anti spam measure: Remove all links in WordPress comments when the comment form is being submitted, using a filter hook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wh_remove_comment_links( $content ) { | |
global $allowedtags; | |
$tags = $allowedtags; | |
unset( $tags['a'] ); | |
$content = addslashes( wp_kses( stripslashes( $content ), $tags ) ); | |
return $content; | |
} | |
add_filter( 'pre_comment_content', 'wh_remove_comment_links' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment