I was inspired by this Q&A: Add a Custom Field in Comment Box next to the Text area but I have to insert the custom field after the textarea but before the Send button.

I did not found the proper action to customize and I guess it not exists at all.

comment_form_after_fields puts my output before textarea
comment_form_after puts my output after Send button

Am I wrong?

    add_action( 'comment_form_after', 'test');

function test(){
    echo "TEST";
}
    add_action( 'comment_form_after_fields', 'test');

function test(){
    echo "TEST";
}

1 Answer
1

Filter comment_form_defaults and add your code to the textarea.

Sample code, not tested:

add_filter( 'comment_form_defaults', 'wpse_120049_extend_textarea' );

function wpse_120049_extend_textarea( $args )
{
    $args['comment_field'] .= '<p>Extra text.</p>';
    return $args;
}

Leave a Reply

Your email address will not be published. Required fields are marked *