Delete custom post type metadata without deleting the post in admin area
You have add_post_meta() and update_post_meta(), but you only need the latter: This may be used in place of add_post_meta() function. The first thing this function will do is make sure that $meta_key already exists on $post_id. If it does not, add_post_meta($post_id, $meta_key, $meta_value) is called instead and its result is returned. What you are doing … Read more