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

Question

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

The form looks like this:

<form action="https://example.org/wp-comments-post.php" method="post" id="commentform" class="comment-form">
  <p class="comment-form-comment">
    <label for="comment">
      Comment
    </label>
    <textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required="required"></textarea>
  </p>
  <p class="comment-form-author">
    <label for="author">
      Name<span class="required"> *</span>
    </label>
    <input id="author" name="author" type="text" value="" size="30" aria-required="true">
  </p>
  <p class="comment-form-email">
    <label for="email">
      Email<span class="required"> (optional)</span>
    </label>
        <input id="email" name="email" type="text" value="" size="30" aria-required="false">
  </p>
  <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. 
    </label>
  </p>
  <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">
  </p>
</form>

The action is pointing to https://example.org/wp-comments-post.php, 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?

0
Zeth 1 month 0 Answers 10 views 0

Leave an answer