Possible Duplicate:
Prevent post from being published if custom fields not filled
Check before publishing, if already exist post with current custom field value

I am trying to add some metaboxes to post edit page. They contain essential data for my template so I have to make sure they are filled and valid.

Validating them is not a problem. Before saving data I check them. But what to do when they are incorrect? I would like to stop saving process and print some nice error message but I have not found any reasonable way to do that. The post shall not be saved without these forms validly filled.

Thanks for help.

marked as duplicate by Stephen Harris, fuxia Jul 9 '12 at 21:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • See also: wordpress.stackexchange.com/a/42178/9364. The above link refers to checking if meta data already exists in another post, and this if the mete data is 'invalid' - but the principle is the same. – Stephen Harris Jun 10 '12 at 15:07
  • Thanks for the links, they are really helpful. Trying to solve it. – Rusty Horse Jun 10 '12 at 16:07