I don't know what the `return` here does or why it worked before for you, but you shouldn't `return` there:

```php
<?php else: ?>
	<?php return $cached_result; ?>
<?php endif; ?>
```

Instead, that should be written as:

```php
<?php else: ?>
	<?php $array = json_decode($cached_result, true); ?>
<?php endif; ?>
```

Because the code that follows has `$array['data']`:

```php
<?php
/* Loop through the array and only pull API fields */
$mediaUrls = array_map(function($entry) {
	...
}, $array['data']);
?>
```

Additionally, you should read the cached result the same way you read the non-cached result; i.e.:

```php
// Reading the non-cached result.
$array = json_decode($result, true);

// And reading the cached result.
$array = json_decode($cached_result, true);
```

But if you actually did mean to `return` the data, then perhaps you should do `return json_decode( $cached_result, true );` ..