'GET', 'headers' => array( 'X-Forwarded-For' => ( new Automattic\Jetpack\Status\Visitor() )->get_ip( true ), ), ), null, 'rest' ); $body = wp_remote_retrieve_body( $request ); if ( 200 === wp_remote_retrieve_response_code( $request ) ) { return json_decode( $body ); } else { return $body; } } /** * Get plan information for a plan given its slug * * @since 7.7.0 * * @param string $plan_slug Plan slug. * * @return object The plan object */ public static function get_plan( $plan_slug ) { $plans = self::get_plans(); if ( ! is_array( $plans ) ) { return; } foreach ( $plans as $plan ) { if ( $plan_slug === $plan->product_slug ) { return $plan; } } } }