Add a ‘Thank you’-message after comment has been submitted


How do I add a ‘Thank you’-message, after someone submits a comment?

The form looks like this:

<form action="" method="post" id="commentform" class="comment-form">
  <p class="comment-form-comment">
    <label for="comment">
    <textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required="required"></textarea>
  <p class="comment-form-author">
    <label for="author">
      Name<span class="required"> *</span>
    <input id="author" name="author" type="text" value="" size="30" aria-required="true">
  <p class="comment-form-email">
    <label for="email">
      Email<span class="required"> (optional)</span>
        <input id="email" name="email" type="text" value="" size="30" aria-required="false">
  <p class="comment-form-cookies-consent">
    <input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes">
    <label for="wp-comment-cookies-consent">
      Save my name, email and URL in this browser for next time I'm commenting. 
  <p class="form-submit">
    <input name="submit" type="submit" id="submit" value="Write comment" class="submit">
    <input type="hidden" name="comment_post_ID" value="1133" id="comment_post_ID">
    <input type="hidden" name="comment_parent" id="comment_parent" value="0">

The action is pointing to, so the form is handled there and then returned to the current page.

If I print_r( $_POST ); on that page, then it’s an empty array (since the form has been handled).

So how do I print a ‘Thank you for commenting’-message?

Zeth 8 months 2020-12-11T12:10:26-05:00 0 Answers 10 views 0

Leave an answer