12% off of LTD using this coupon: TWELVEPERCENTOFF. Promo ends on 2 Dec midnight UTC.
Published on Aug 1, 2018

How to change the text before the comment form fields in WordPress

Sridhar Katakam

Looking to change the default “Your email address will not be published. Required fields are marked *” text that appears above the input fields in WordPress comment form?

Use the following code snippet:

add_filter( 'comment_form_defaults', 'my_comment_form_defaults' );
/**
 * Customize the text prior to the comment form fields.
 * @param  array $defaults
 * @return $defaults
 */
function my_comment_form_defaults( $defaults ) {

    $defaults['comment_notes_before'] = '<p class="comment-notes">'. __( 'Your email address will not be published. Required fields are marked *', 'my-text-domain' ).'</p>';

    return $defaults;

}

Change/set your desired text in the above.

One of the several ways in which this code can be added is as a new Snippet when using the Code Snippets plugin. Set the code to appear on frontend only.

Source: https://gist.github.com/ramseyp/8812696

tagschevron-leftchevron-rightchainangle-rightangle-upangle-downfolder-omagnifiercrossmenuchevron-downarrow-right