Created
November 19, 2015 01:23
-
-
Save mAAdhaTTah/fe2c64f2acfe33b28ef9 to your computer and use it in GitHub Desktop.
save_post Error Reporting Boilerplate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'admin_notices', 'my_error_messages' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'save_post', 'my_save_post_function' ); | |
function my_save_function( $post_id ) { | |
$error = false; | |
// Do stuff. | |
if ($something_went_wrong) { | |
$error = $result; | |
} | |
if ($error) { | |
return $error; | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment