Skip to content

Instantly share code, notes, and snippets.

@shameemreza
Created October 11, 2018 03:27
Show Gist options
  • Save shameemreza/b7adf77c7df7460642613d89a7b2c3ec to your computer and use it in GitHub Desktop.
Save shameemreza/b7adf77c7df7460642613d89a7b2c3ec to your computer and use it in GitHub Desktop.
function shameem_comment_post( $incoming_comment ) {
$incoming_comment['comment_content'] = htmlspecialchars($incoming_comment['comment_content']);
$incoming_comment['comment_content'] = str_replace( "'", ''', $incoming_comment['comment_content'] );
return( $incoming_comment );
}
function shameem_comment_display( $comment_to_display ) {
$comment_to_display = str_replace( ''', "'", $comment_to_display );
return $comment_to_display;
}
add_filter( 'preprocess_comment', 'shameem_comment_post', '', 1);
add_filter( 'comment_text', 'shameem_comment_display', '', 1);
add_filter( 'comment_text_rss', 'shameem_comment_display', '', 1);
add_filter( 'comment_excerpt', 'shameem_comment_display', '', 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment