comment_form
comment_form ( $args = array(), $post = null )
Parameters:- (array) args { Optional. Default arguments and form fields to override. @type array $fields { Default comment fields, filterable by default via the {@see 'comment_form_default_fields'} hook. @type string $author Comment author field HTML. @type string $email Comment author email field HTML. @type string $url Comment author URL field HTML. @type string $cookies Comment cookie opt-in field HTML. } @type string $comment_field The comment textarea field HTML. @type string $must_log_in HTML element for a 'must be logged in to comment' message. @type string $logged_in_as The HTML for the 'logged in as [user]' message, the Edit profile link, and the Log out link. @type string $comment_notes_before HTML element for a message displayed before the comment fields if the user is not logged in. Default 'Your email address will not be published.'. @type string $comment_notes_after HTML element for a message displayed after the textarea field. @type string $action The comment form element action attribute. Default '/wp-comments-post.php'. @type string $id_form The comment form element id attribute. Default 'commentform'. @type string $id_submit The comment submit element id attribute. Default 'submit'. @type string $class_container The comment form container class attribute. Default 'comment-respond'. @type string $class_form The comment form element class attribute. Default 'comment-form'. @type string $class_submit The comment submit element class attribute. Default 'submit'. @type string $name_submit The comment submit element name attribute. Default 'submit'. @type string $title_reply The translatable 'reply' button label. Default 'Leave a Reply'. @type string $title_reply_to The translatable 'reply-to' button label. Default 'Leave a Reply to %s', where %s is the author of the comment being replied to. @type string $title_reply_before HTML displayed before the comment form title. Default: '<h3 id="reply-title" class="comment-reply-title">'. @type string $title_reply_after HTML displayed after the comment form title. Default: '</h3>'. @type string $cancel_reply_before HTML displayed before the cancel reply link. @type string $cancel_reply_after HTML displayed after the cancel reply link. @type string $cancel_reply_link The translatable 'cancel reply' button label. Default 'Cancel reply'. @type string $label_submit The translatable 'submit' button label. Default 'Post a comment'. @type string $submit_button HTML format for the Submit button. Default: '<input name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s" />'. @type string $submit_field HTML format for the markup surrounding the Submit button and comment hidden fields. 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. @type string $format The comment form format. Default 'xhtml'. Accepts 'xhtml', 'html5'. }
- (int|WP_Post) post Optional. Post ID or WP_Post object to generate the form for. Default current post.
Defined at:Change Log:- 4: .
- 4: .
- 4: .
- 4: .
- 4: .
- 4: .
- 5: .
- Introduced in WordPress: 3.0.0
- Deprecated in WordPress: —
Description
Outputs a complete commenting form for use within a template.Most strings and form fields may be controlled through the `$args` array passed
into the function, while you may also choose to use the {@see 'comment_form_default_fields'}
filter to modify the array of default fields if you'd just like to add a new
one or remove a single field. All fields are also individually passed through
a filter of the {@see 'comment_form_field_$name'} where `$name` is the key used
in the array of fields.