do_action( 'comment_form', int $post_id )

Fires at the bottom of the comment form, inside the closing form tag.


Parameters Parameters

$post_id

(int) The post ID.


Top ↑

More Information More Information

comment_form is a template hook triggered at the bottom of a form rendered by comment_form() right before the closing </form>.

Functions hooked to this action receive the post ID as a parameter.


Top ↑

Source Source

File: wp-includes/comment-template.php

View on Trac



Top ↑

Changelog Changelog

Changelog
Version Description
1.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Collins Mbaka
    /**
     * Displays an extra text area for more comments.
     *
     * @param int $post_id The ID of the post where the comment form was rendered.
     */
    function wporg_more_comments( $post_id ) {
    	echo '<p class="comment-form-more-comments"><label for="more-comments">' . __( 'More Comments', 'your-theme-text-domain' ) . '</label> <textarea id="more-comments" name="more-comments" cols="45" rows="8" aria-required="true"></textarea></p>';
    }
    
    add_action( 'comment_form', 'wporg_more_comments' );
    

You must log in before being able to contribute a note or feedback.