Hi,
Sorry, it does not remove comment fields, It suppose to add extra fields with comments.
Thank you for the quick response, just wanted to make sure that I wasn’t missing anything.
This should do the trick…
1. Insert this into your functions.php
// add default comment
function rei_preprocess_comment($comment_data) {
if ($comment_data['comment_content'] == '%dummy-text%') {
$comment_data['comment_content'] = ''; // replace dummy text.
}
return $comment_data;
}
add_filter('preprocess_comment', 'rei_preprocess_comment');
function rei_wp_footer() {
?>
<script>
jQuery(function($){
var comment = $('textarea#comment');
comment.removeAttr('required'); // remove required attribute of textarea.
$('#commentform').on('submit',function(){
if (comment.val() == '') {
comment.css('text-indent','-999px').val('%dummy-text%'); // change to dummy text.
}
});
});
</script>
<?php
}
add_action( 'wp_footer', 'rei_wp_footer' );
2. Use css to hide comment box
(@wpaddiction)
8 years, 4 months ago
Does this plugin have any options to remove or replace the required comment textarea? I would like the only required field to be a video URL and don’t really have a use for a textarea. Any help would be greatly appreciated.
For additional information, you can see my original support post at https://ww.wp.xz.cn/support/topic/remove-required-comment-textarea/.
The page I need help with: [log in to see the link]