Introduce WP_JSON_Posts::get_post_data() helper to DRY up repetitive code

See #237