URL Shortener
Plugin stops all articles from loading when url shortener is down (4 posts)

  1. mehulved
    Posted 3 years ago #

    I have faced this often when my internet connection is not connected and I am working on localhost.
    Today it happened when bitly was not reachable for a while. That was about 3 hours back.
    PHP Fatal error: Cannot use object of type WP_Error as array in public_html/wp-content/plugins/url-shortener/components/jz_shortener/lib/jzsc.shared.php on line 235

    Checking that line of code, it reads

                        $data = $result['body'];

    That throws is an issue when there is an error in actually fetching the data. wp_http instead gives wp_error.
    It would be good to check if the key body exists in the array as follows:

    if (array_key_exists('body',$result) {
        $data = $result['body'];

    Here's the WP_Error thrown by WP_Http when bitly isn't reachable

      public 'errors' =>
        array (size=1)
          'http_request_failed' =>
            array (size=1)
              0 => string 'Could not resolve host: api.bit.ly; Unknown error' (length=49)
      public 'error_data' =>
        array (size=0)


  2. immanence
    Posted 3 years ago #

    Did you find a solution to this? I just got the same error. It takes down my whole site instead of just breaking the plugin. This is not acceptable. Is there a workaround? Temporarily I had to pull the entire plugin.

  3. immanence
    Posted 3 years ago #

    By the way, actually dragging the plugin out of the Plugins folder didn't work in and of itself; I had to login, go to plugins, see the "The plugin url-shortener/url-shortener.php has been deactivated due to an error: Plugin file does not exist." message, and only then did my site come back up.

  4. immanence
    Posted 3 years ago #

    In my case, I pulled the plugin, visited my plugins page, and then pulled the plugin back in and chose a different service (I was on TinyURL and switched to Goo.gl). So far, my short URLs have not been regenerated (the plugin should do that automatically, right?) but the old TinyURL shortlinks still work. The main thing is that the fatal error has disappeared.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • URL Shortener
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.