Change Comment form text
-
Hello,
Add the below code to the functions.php file of the child theme. Modify the code as per your need –
function placeholder_comment_form_fields($fields) { $replace_author = __('Your Name', 'yourdomain'); $replace_email = __('Your Email', 'yourdomain'); $replace_url = __('Your Website', 'yourdomain'); $fields['author'] = '<p class="comment-form-author">' . '<label for="author">' . __( 'Name', 'yourdomain' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input id="author" name="author" type="text" placeholder="'.$replace_author.'" value="' . esc_attr( $commenter['comment_author'] ) . '" size="20"' . $aria_req . ' /></p>'; $fields['email'] = '<p class="comment-form-email"><label for="email">' . __( 'Email', 'yourdomain' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input id="email" name="email" type="text" placeholder="'.$replace_email.'" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>'; $fields['url'] = '<p class="comment-form-url"><label for="url">' . __( 'Website', 'yourdomain' ) . '</label>' . '<input id="url" name="url" type="text" placeholder="'.$replace_url.'" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p>'; return $fields; } add_filter('comment_form_default_fields','placeholder_comment_form_fields');Thanks dear Amit,
I could not make a change by code.
Please assist me more what exactly I should change that is effective.Replace
yourdomainwithoceanwpand edit the textYour Name, Your Email, Your Websiteas per your need.
Add this code to the functions.php file of the oceanwp child theme.Thanks for your reply.
I added this code to the functions.php of my child theme:
function placeholder_comment_form_fields($fields) { $replace_author = __('test', 'oceanwp'); $replace_email = __('test', 'oceanwp'); $replace_url = __('test', 'oceanwp'); $fields['author'] = '<p class="comment-form-author">' . '<label for="author">' . __( 'Name', 'yourdomain' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input id="author" name="author" type="text" placeholder="'.$replace_author.'" value="' . esc_attr( $commenter['comment_author'] ) . '" size="20"' . $aria_req . ' /></p>'; $fields['email'] = '<p class="comment-form-email"><label for="email">' . __( 'Email', 'yourdomain' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input id="email" name="email" type="text" placeholder="'.$replace_email.'" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>'; $fields['url'] = '<p class="comment-form-url"><label for="url">' . __( 'Website', 'yourdomain' ) . '</label>' . '<input id="url" name="url" type="text" placeholder="'.$replace_url.'" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p>'; return $fields; } add_filter('comment_form_default_fields','placeholder_comment_form_fields');Please if is possible to check that is correct or not. Because I can’t see any change on the live site.
Did you clear the cache after adding the code? It should work. Can you link to the site for which you have added the code?
I have not any caching plugin.
Hi,
Texts can be Changeable by ‘SAY WHAT‘ Plugin.
If Change be by functions.php is very good!Hi dear @apprimit
have you checked the site?Do you want to translate the placeholder or want to change it? For translation, you can use Loco translate plugin or edit the Pot file under oceanwp > languages folder using a PoEdit tool.
Thanks @apprimit
No translate.
I want to change placeholder text only.Hi dear @apprimit
I don’t want to translate placeholder text.
I want to change the text only.Thanks
Sorry, but I couldn’t find a solution for it. I’ll update you when I’ll find a solution for it.
The topic ‘Change Comment form text’ is closed to new replies.

(@natasha006)
7 years, 1 month ago
Hello,
I will to change comment form placeholder text.
I don’t find the right file.
http://prnt.sc/new55j
Thanks in advance.