WordPress transient not working with WP Engine
So I don’t know why the return $cached_result; in the else, but if that’s intentional, then you should probably do: return json_decode( $cached_result, true ); Because you’re caching the response body (which is a JSON string) and you’re reading the non-cached result like so: $array = json_decode($result, true);. But if that return was a mistake, … Read more