New Landing How can we help? Themeforest Theme Support Flexform Remove Website Field from Comment Form

Viewing 6 posts - 1 through 6 (of 6 total)
  • Posted in: Flexform
  • #120570
    mrjWells
    Member
    Post count: 137

    I am getting hammered by manually submitted comment spam and would like to eliminate the “Website” field from my comment form. I’ve read some “How To” articles on this but their php recommended changes vary a lot. I am posting the comment form php from flexform below. Could you show me exactly how to alter this code to safely remove the website URL field in my comment form please?

    /* COMMENT ENTRY FORM
    ================================================== */

    ?>

    <?php if ( ‘open’ == $post->comment_status ) : ?>
    <div id=”respond-wrap”>
    <?php
    $commenter = wp_get_current_commenter();
    $req = get_option( ‘require_name_email’ );
    $aria_req = ( $req ? ” aria-required=’true'” : ” );
    $fields = array(
    ‘author’ => ‘<p class=”comment-form-author”><label for=”author”>’ . __( ‘Name’, ‘swiftframework’ ) . ‘</label> ‘ . ( $req ? ‘<span class=”required”>*</span>’ : ” ) . ‘<input id=”author” name=”author” type=”text” value=”‘ . esc_attr( $commenter[‘comment_author’] ) . ‘” size=”30″‘ . $aria_req . ‘ /></p>’,
    ’email’ => ‘<p class=”comment-form-email”><label for=”email”>’ . __( ‘Email’, ‘swiftframework’ ) . ‘</label> ‘ . ( $req ? ‘<span class=”required”>*</span>’ : ” ) . ‘<input id=”email” name=”email” type=”text” value=”‘ . esc_attr( $commenter[‘comment_author_email’] ) . ‘” size=”30″‘ . $aria_req . ‘ /></p>’,
    ‘url’ => ‘<p class=”comment-form-url”><label for=”url”>’ . __( ‘Website’, ‘swiftframework’ ) . ‘</label><input id=”url” name=”url” type=”text” value=”‘ . esc_attr( $commenter[‘comment_author_url’] ) . ‘” size=”30″ /></p>’
    );
    $comments_args = array(
    ‘fields’ => apply_filters( ‘comment_form_default_fields’, $fields ),
    ‘logged_in_as’ => ‘<p class=”logged-in-as”>’ . sprintf( __( ‘Logged in as %2$s. Log out?‘, ‘swiftframework’ ), admin_url( ‘profile.php’ ), $user_identity, wp_logout_url( apply_filters( ‘the_permalink’, get_permalink( ) ) ) ) . ‘</p>’,
    ‘title_reply’ => __( ‘Leave a reply’, ‘swiftframework’ ),
    ‘title_reply_to’ => __( ‘Leave a reply to %s’, ‘swiftframework’ ),
    ‘cancel_reply_link’ => __( ‘Click here to cancel the reply’, ‘swiftframework’ ),
    ‘label_submit’ => __( ‘Post comment’, ‘swiftframework’ ),
    ‘comment_field’ => ‘<p class=”comment-form-comment”><label for=”comment”>’ . __( ‘Comment’, ‘swiftframework’ ) . ‘</label><textarea id=”comment” name=”comment” cols=”45″ rows=”8″ aria-required=”true”></textarea></p>’,
    ‘must_log_in’ => ‘<p class=”must-log-in”>’ . sprintf( __( ‘You must be logged in to post a comment.’, ‘swiftframework’ ), wp_login_url( apply_filters( ‘the_permalink’, get_permalink( ) ) ) ) . ‘</p>’,
    );
    ?>

    <?php comment_form($comments_args); ?>
    </div>
    <?php endif /* if ( ‘open’ == $post->comment_status ) */ ?>
    </div><!– #comments –>

    #120587
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,

    I guess the easier solution is to hide the field with css.
    Try to add the code below to your theme custom css.

    
    .comment-form-url{
    display:none!important;
    }

    -Rui

    #120590
    mrjWells
    Member
    Post count: 137

    Wow! What a simple and elegant solution Rui. I didn’t think it could be accomplished with CSS, but your code worked perfectly. This should make a huge difference, thanks!

    #120593
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Great. I guess you will receive less comments this way.
    -Rui

    #120597
    mrjWells
    Member
    Post count: 137

    Without the URL field the manually submitted spam comments should be reduced by about 90% because they do it for the link. I may lose a few legitimate comments, but that’s a price I am willing to pay to stop the hundreds of spam comments being trapped in my spam folder each day. Between the spam bot attacks and the bloated spam folder my sight pulled so many hosting resources that it got shut down the other day. With your help and a few other tweaks, I think the situation is now under control.

    #120599
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Great. Really boring the comments to generate backlinks.
    -Rui

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register