appending `new_pricing_202208=1` to URL. if ( Helper::is_forced_new_pricing_202208() ) { $tier_pricing['pricing_version'] = Plan::JETPACK_SEARCH_NEW_PRICING_VERSION; } return rest_ensure_response( $tier_pricing ); } /** * Forward remote response to client with error handling. * * @param array|WP_Error $response - Response from WPCOM. */ protected function make_proper_response( $response ) { if ( is_wp_error( $response ) ) { return $response; } $body = json_decode( wp_remote_retrieve_body( $response ), true ); $status_code = wp_remote_retrieve_response_code( $response ); if ( 200 === $status_code ) { return $body; } return new WP_Error( isset( $body['error'] ) ? 'remote-error-' . $body['error'] : 'remote-error', isset( $body['message'] ) ? $body['message'] : 'unknown remote error', array( 'status' => $status_code ) ); } /** * Get blog id */ protected function get_blog_id() { return $this->is_wpcom ? get_current_blog_id() : Jetpack_Options::get_option( 'id' ); } }