From 72b7a70c26a7eceb788d42607cd8e7489a7f802d Mon Sep 17 00:00:00 2001 From: savvasha Date: Thu, 7 Jul 2022 21:19:36 +0300 Subject: [PATCH] FIX: Rest API not returns Critical Error when the user uses i.e. _fields=statistics of a player --- includes/api/class-sp-rest-api.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/api/class-sp-rest-api.php b/includes/api/class-sp-rest-api.php index d61c2162..dee04181 100644 --- a/includes/api/class-sp-rest-api.php +++ b/includes/api/class-sp-rest-api.php @@ -844,7 +844,8 @@ if ( ! class_exists( 'SP_REST_API' ) ) : * @return mixed */ public static function get_post_data( $object, $field_name, $request ) { - $type = $object['type']; + //$type = $object['type']; + $type = get_post_type( $object['id'] ); $post = new $type( $object['id'] );