R
R
RaTeNs2015-12-11 19:54:56
WordPress
RaTeNs, 2015-12-11 19:54:56

Why did spam protection stop working without WordPress plugins?

Hello, in connection with the update of Wordpress, a new class WP_Comment was added, the code stopped working

add_filter('pre_comment_on_post', 'verify_spam');
 
function verify_spam($commentdata) {
  $spam_test_field = trim($_POST['comment']);
  if(!empty($spam_test_field)) wp_die('Спаму нет!');
  $comment_content = trim($_POST['real-comment']);
  $_POST['comment'] = $comment_content;
  return $commentdata;
}

How to decide?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
litvin2, 2015-12-16
@litvin2

Spammers have adapted to the mold. Their field names are quite clear: comment and real-comment. A spamming bot reconfigures itself in a second.
Better use this simple plugin: https://wordpress.org/plugins/anti-spam/ . It is extremely undemanding to resources, but is 200% effective.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question