0

Submitting a post comment without message leads to a white page with a clean WP error message "ERROR: please type a comment."

Is it possible to achieve the same thing for input fields from a custom form? For instance, I've got my own custom contact page template containing a number of input fields, some of them I want to make required. How to get the same WP error message when those haven't been filled?

1

I believe yo are looking for wp_die which will Kill WordPress execution and display HTML message with error message.

But the codex says:

It is not recommended to call this function very often and try to handle as many errors as possible silently.

  • Thanks a lot Bainternet. I think "very often" is too vague though, does calling it for missing fields in contact form fall into the "very often" category? – drake035 Feb 15 '13 at 11:40
  • 1
    not really IMHO – Bainternet Feb 15 '13 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.