Prefill the textarea in comment_form

I was answered in the WordPress Forums. The solution is to pass the entire HTML for the comment_field, like this: ‘comment_field’ => ‘<textarea id=”comment” name=”comment” cols=”45″ rows=”5″ maxlength=”65525″ required=””>’. __(‘Prewritten comment’,’textdomain’).'</textarea>’,

Wanted to get rid of Paragrapgh tag in submit buttom of the WordPress form

If you control the theme the simplest way to fix this is passing the submit_field argument into comment_form(): comment_form( array( ‘submit_field’ => ‘%1$s %2$s’, ) ); Default: <p class=”form-submit”>%1$s %2$s</p>, where %1$s is the submit button markup and %2$s is the comment hidden fields. which removes the <p> altogether. However it might be useful to … Read more

Is there a way to edit the markup of comment_form()?

I covered just the other day some of the comment (textarea) filters here, https://wordpress.stackexchange.com/a/366147/144392 But the filters you may want to look into are most likely, comment_form_fields comment_form_field_{$name} EDIT 11.5.2020: Codex example for comment_form($args), $comments_args = array( // Change the title of send button ‘label_submit’ => __( ‘Send’, ‘textdomain’ ), // Change the title of … Read more

How to hide and disable URL and email fields from comments?

After further research I found some relevant functions. Keep in mind it’s probably better to separate these into different functions, and if your WordPress theme gives you any trouble, check this out. // disable url field function disable_comment_url($fields) { if(isset($fields[‘url’])) unset($fields[‘url’]); return $fields; } add_filter(‘comment_form_default_fields’, ‘disable_comment_url’); // disable email field function disable_comment_email($fields) { if(isset($fields[’email’])) unset($fields[’email’]); … Read more

Replace Entire Comment Box with Text

Something like this should be pretty universally functional across themes, as long as they use something like the normal comment form code. if ( ! current_user_can( $capability_required_for_commenting ) ) { add_filter(‘comments_open’, ‘disable_comments’, 20, 2); add_action(‘comment_form_comments_closed’, ‘display_no_comment_permissions_message’ ); } And then somewhere you’ll want to define: function disable_comments() { return false; } function display_no_comment_permissions_message() { ?> … Read more