I have a custom post type with several custom fields. I am looking to do some validation on these fields because they will be used downstream by other services. So, it is important that it can’t be saved until it is correctly entered. The validation is reasonably complex and requires custom logic.

Unfortunately, it also won’t work to use a plugin in this particular case.

Is there an ideal hook to use in this case? At a high level — whats the best way to go about this.

2 Answers
2

Example code in add_meta_box() documentation uses save_post hook (at the very end of wp_insert_post() function) to add custom fields data from metabox.

You must be using something like that already in your metaboxes, is it not appropriate place to validate your data?..

Leave a Reply

Your email address will not be published. Required fields are marked *