Skip to content

Instantly share code, notes, and snippets.

@mAAdhaTTah
Created November 19, 2015 01:23
Show Gist options
  • Save mAAdhaTTah/fe2c64f2acfe33b28ef9 to your computer and use it in GitHub Desktop.
Save mAAdhaTTah/fe2c64f2acfe33b28ef9 to your computer and use it in GitHub Desktop.
save_post Error Reporting Boilerplate
add_action( 'admin_notices', 'my_error_messages' );
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