don't publish custom post type post if a meta data field isn't valid

Written by  on October 11, 2016 

I have a custom post type (CPT) called event. I have a meta box for the type with several fields. I would like to validate some fields before publishing an event. For example, if an event’s date is not specified I would like to display an informative error message, save the event for future editing, but prevent that event from being published. Is ‘pending’ status for an CPT post without all necessary info the right way to treat it?

What’s the best practice to do CPT fields validation and prevent a post from being published, but save it for future editing.

Many thanks,