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.

  • 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. Jun 10, 2012 at 15:07
  • Thanks for the links, they are really helpful. Trying to solve it. Jun 10, 2012 at 16:07


Browse other questions tagged or ask your own question.