Better force $post to be a WP_Post object as we are assuming it is of that type within the function