A simply way to block spam comments on WordPress (2)

Change the 20th line of the file wp-comments-post.php in the root folder:

$comment_post_ID = isset($_POST[‘comment_post_ID’]) ? (int) $_POST[‘comment_post_ID’] : 0;
to:

if ($_POST[‘yanzhengma’] == ‘919191’) {
$comment_post_ID = isset($_POST[‘comment_post_ID’]) ? (int) $_POST[‘comment_post_ID_iblog’] : 0;
}

Below the 1548th line ” <?php echo $args[‘comment_notes_after’]; ?> ” of the file “ wp-comment-template.php ” under the “ wp-includes ” folder, add this line:

<p>Put “919191” here, then click “Post Comment” button to submit.
<input type=’text’ name=’yanzhengma’ id=’yanzhengma’ /></p>

2 thoughts on “A simply way to block spam comments on WordPress (2)

  1. Pingback: A simply way to block spam comments on WordPress (1) | Mia's Blog

Leave a Reply

Your email address will not be published. Required fields are marked *