[Resolved] Customize text on comment form

Home Forums Support Customize text on comment form

  • This topic has 3 replies, 2 voices, and was last updated 5 months ago by Leo.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #1296323

    I am trying to change the text on the comment form.

    Rather than it show things like “Leave a Comment” or the submit button having “Post Comment” — I want it to say “Leave an Answer” and “Post Answer.”

    I attempted to do this like so:

    function change_comment_form( $defaults ) {
    	$defaults['comment_field'] = sprintf(
    		'<p class="comment-form-comment"><label for="comment" class="screen-reader-text">%1$s</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
    		esc_html__( 'Comment', 'generatepress' )
    	$defaults['comment_notes_before']	= null;
    	$defaults['comment_notes_after']	= null;
    	$defaults['id_form'] 				= 'answerform';
    	$defaults['id_submit'] 				= 'submit';
    	$defaults['title_reply'] 			= apply_filters( 'generate_leave_comment', __( 'Leave an Answer', 'generatepress' ) );
    	$defaults['label_submit'] 			= apply_filters( 'generate_post_comment', __( 'Post Answer', 'generatepress' ) );
    	return $defaults;
    add_filter( 'comment_form_default_fields', 'change_comment_form' );

    But it doesn’t work and I’m sure it’s probably not the way you’d prefer.

    Please advise.

    Thank you.

    Customer Support

    Yep, worked perfectly. Thanks!

    Customer Support
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.