• Resolved KatieKat

    (@katiekat)


    Hi there,
    I raised this about a year ago and there was mention of adding some filters and wondered if it can be sorted.

    I have a minimum comment length of 50 characters in my functions file
    using the following code.

    add_filter( ‘preprocess_comment’, ‘minimal_comment_length’ );
    function minimal_comment_length( $commentdata ) {
    $minimalCommentLength = 50;
    if ( strlen( trim( $commentdata[‘comment_content’] ) ) < $minimalCommentLength )
    {
    wp_die( ‘All comments must be at least ‘ . $minimalCommentLength . ‘ characters long.’ );
    }
    return $commentdata;
    }

    However when a user edits a comment it is not picking up the restriction and the user is able to edit a comment to less than 50 characters. Is there any way of linking into the above code so that it forces a user to make a comment of more than 50 characters when editing a comment.

    Kind Regards

    KatieKat

    https://www.ads-software.com/plugins/simple-comment-editing/

Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Editing comment when minimal comment length set’ is closed to new replies.