Saving zero as meta value
if ( !$value ) evaluates to TRUE when the value is 0. Alternative: if ( ! isset ( $_POST[‘_ordre’] ) ) return delete_post_meta( $post_id, ‘_ordre’ ); update_post_meta( $post_id, ‘_ordre’, $_POST[‘_ordre’] ); You don’t need add_post_meta(), the call to update_post_meta() will do that automatically.