Add a meta to a post submited from a frontend form
Because the $post_id variable will return the ID of the new post, it was sufficient to change the line: $post_id = add_post_meta($post_id, ‘location2’, $data[‘postLocation2’]); to: add_post_meta($post_id, ‘location2’, $data[‘postLocation2’]);