Skip to content

Instantly share code, notes, and snippets.

@pento
Last active December 28, 2015 06:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pento/7459299 to your computer and use it in GitHub Desktop.
Save pento/7459299 to your computer and use it in GitHub Desktop.
Prevent password leaks in WordPress comments
<?php
function hunter2( $comment_text, $comment ) {
if ( get_current_user_id() !== $comment->user_id ) {
$comment_text = str_replace( 'hunter2', '*******', $comment_text );
}
return $comment_text;
}
add_filter( 'get_comment_text', 'hunter2', 1, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment