• 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 392

    Checking 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.

Viewing 1 replies (of 1 total)
  • Plugin Author Matt Cromwell

    (@webdevmattcrom)

    Hmmm… thanks for reporting this. We do actually provide a cached result with the plugin. If you go into the widget and open the “Advanced Options” section you can see the settings for how long you want the cache to be set for.

    But even then, it will have to hit the API at some point and you’re right that a 404 from the API shouldn’t trigger a fatal error. We’ll dig into that. Thanks!

Viewing 1 replies (of 1 total)
  • The topic ‘Yelp Widget Fails to Load / Breaks Site’ is closed to new replies.