Add Placeholder to Your Comment Form in WordPress

By default, WordPress doesn’t support placeholder in their function form. To add this function simply add this code to your functions.php.

Here’s the code to alter the default comment form Name, Email, and Website:

And now the Comment part:

Here’s the final result:


How To, PHP, snippet, Wordpress,

6 thoughts on “Add Placeholder to Your Comment Form in WordPress

  1. Hello and thank you for the interesting blog.

    I have two questions please. First: in my website, I have the comment field displayed before both the author and the email fields. Do I need to invert the codes in php and place the “function placeholder_comment_form_field” before the “function placeholder_author_email_url_form_fields”?

    Second question: I removed the “URL” field, from my comment form. Shall I just remove the following codes from your PHP “$replace_url” and “$fields[‘url’]” inside the “function placeholder_author_email_url_form_fields”?

    Many thanks.


    1. Hi Luca, sorry for the late reply:
      #1 You can place the codes randomly, actually.
      #2 You can either remove or keep it.

  2. Textarea (comment field) replacement is incorrect, because it is remove stars of rating from woocommerce product pages at “add review” area

Any idea? Fill the comment below

This site uses Akismet to reduce spam. Learn how your comment data is processed.