Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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