I am looking for a way to handle errors for a custom post type with its own custom fields. This is all part of a plugin I’m writing, however, after extensive research the only way I found is through sessions (or similar) and show it on the next page, (in which case it would save the changes).
Is there any other way of handling errors and preventing WordPress from saving the post type if something is wrong? If so how? I figured WP_Error class would work, but without luck.
If anyone can help, that would be great!
Thanks!
WordPress have
WP_Error
class for checking WordPress errors and error messages since version 2.1.0. WordPress use object ofWP_Error
class for reporting error from several WP function. However, we can use this object in plugin or theme to handle error within WordPress. This class containing verious useful method for managing error.All methods
Source and hint: more background on this post