[wp-hackers] CPT meta box error messages

Andy Charrington-Wilden andycharrington at gmail.com
Sun Oct 9 21:09:18 UTC 2011


I am trying to figure out how to display a validation error on the input (or lack of) from a meta box in a custom post type. 

Values from a meta box on my CPT are used to query an external API which sends back it's own error messages. The meta box values are being saved via the save_post action. Obviously I can't just echo out a message div there because of the redirect. 

I'm fine with the post being saved regardless of the meta inputs. 

I have looked in to the WP_error class but couldnt figure it out. I've also had a look at transients but that seems just as bad as storing an option as what if two users on the same site submit a post one after another? It's possible the second user will get the error of the first. 

Should I do a redirect with a "message" $_GET variable?? :-/

Am I missing something glaringly obvious? There seems to be little support for custom error messages generated from a meta box value on a CPT. 

Thank you!


Sent from my iPhone

More information about the wp-hackers mailing list