The save_post
hook is the only one you need, also, your callback function is missing a parameter, check this example:
/**
* Save post metadata when a post is saved.
*
* @param int $post_id The ID of the post.
*/
function save_book_meta( $post_id ) {
/*
* In production code, $slug should be set only once in the plugin,
* preferably as a class property, rather than in each function that needs it.
*/
$slug = 'book';
// If this isn't a 'book' post, don't update it.
if ( $slug != $_POST['post_type'] ) {
return;
}
// - Update the post's metadata.
if ( isset( $_REQUEST['book_author'] ) ) {
update_post_meta( $post_id, 'book_author', sanitize_text_field( $_REQUEST['book_author'] ) );
}
if ( isset( $_REQUEST['publisher'] ) ) {
update_post_meta( $post_id, 'publisher', sanitize_text_field( $_REQUEST['publisher'] ) );
}
// Checkboxes are present if checked, absent if not.
if ( isset( $_REQUEST['inprint'] ) ) {
update_post_meta( $post_id, 'inprint', TRUE );
} else {
update_post_meta( $post_id, 'inprint', FALSE );
}
}
add_action( 'save_post', 'save_book_meta' );
The example can be found in the Codex page for the save_post
action hook.