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

Need help implementing a tutorial in your site or want to hire me for custom work?

HIRE ME

Find the article helpful and wish to donate?

DONATE

Comments

For adding code blocks wrap the code in three backticks. Markdown should work.
Provide a URL of your site/webpage if something is not working.
magnifiercross
>
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram
%d bloggers like this: