Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Flexform › Remove Website Field from Comment Form
New Landing › How can we help? › Themeforest Theme Support › Flexform › Remove Website Field from Comment Form
- This topic has 5 replies, 2 voices, and was last updated 10 years by Rui Guerreiro – SUPPORT.
-
Posted in: Flexform
-
October 15, 2014 at 6:31 pm #120570
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 –>October 15, 2014 at 9:10 pm #120587Hi,
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
October 15, 2014 at 9:27 pm #120590Wow! 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!
October 15, 2014 at 9:41 pm #120593Great. I guess you will receive less comments this way.
-RuiOctober 15, 2014 at 9:59 pm #120597Without 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.
October 15, 2014 at 10:04 pm #120599Great. Really boring the comments to generate backlinks.
-Rui -
Posted in: Flexform
You must be logged in and have valid license to reply to this topic.