Yelp Widget Fails to Load / Breaks Site
-
Hi,
We’re having an issue where the Yelp plugin breaks the loading of our site if the request it is making to the Yelp API fails.
Error from our logs:
PHP Fatal error: Cannot use object of type WP_Error as array in /var/www/repositories/ (…) /dw/wp-content/plugins/yelp-widget-pro/widget.php on line 392Checking that code/ line #, it looks like you all are attempting to use the response without checking for errors first:
if ( empty( $data[‘body’] ) ) {While it’s true that the Yelp API shouldn’t go down much (and who knows, maybe our server is just having issues communicating with Yelp), it would be preferable to check for errors and if possible keep the cached results or fail gracefully in the case this request doesn’t work. Otherwise, this causes a runtime error that stops our site from loading correctly.
- The topic ‘Yelp Widget Fails to Load / Breaks Site’ is closed to new replies.