My requirements are bit different I was able to hide email and website field with filter but what I want to know is there a way to make comment text un-required when I am giving comment without comment text area filled its giving me error that comment is required please guide me how i can make comment text unrequired.
add_action('pre_comment_on_post', 'dump_comment');
function dump_comment($post_id, $author=null, $email=null) {
$comcnt = $cmntcount = comments_number( '#0', '#1', '#%' );
$comment = ( isset($_POST['comment']) ) ? trim($_POST['comment']) : null;
if (!$comment) {
$_POST['comment'] = 'Design' . $comcnt;
}
}
Updated and working code.
add_action('pre_comment_on_post', 'dump_comment');
function dump_comment($post_id, $author=null, $email=null) {
$comment = ( isset($_POST['comment']) ) ? trim($_POST['comment']) : null;
if (!$comment) {
$_POST['comment'] = 'Design #' . get_comments_number();
}
}
making the comment unique everytime. by adding the value of comment count.