• Resolved m266

    (@m266)


    Hi,

    how can I block short spam comments?
    Example: jrWesVmSlHGIJ

    Thanks for your help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author nintechnet

    (@nintechnet)

    You can use the .htninja script.
    For instance, this assumes that you don’t want anyone to post a comment shorter than 15 characters using the WordPress built-in comment forms (it won’t work if you’re using third-party plugins to create forms):

    <?php
    /*
     +===========================================================================================+
     | NinjaFirewall optional configuration file                                                 |
     |                                                                                           |
     | See: https://blog.nintechnet.com/ninjafirewall-wp-edition-the-htninja-configuration-file/ |
     +===========================================================================================+
    */
    
    // Block comments that are shorter than 15 characters
    if ( strpos( $_SERVER['SCRIPT_FILENAME'], 'wp-comments-post.php') !== FALSE &&
       strlen( $_POST['comment'] ) < 15 ) {
       return 'BLOCK';
    }
    
    Thread Starter m266

    (@m266)

    OK.
    Thanks for your info.

    Best regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Block comments that are too short’ is closed to new replies.