Support » Plugin: Social Slider Feed » Cannot use object of type WP_Error as array

  • Hi,
    I get “Cannot use object of type WP_Error as array” on line 971 in file “/instagram-slider-widget/instaram_slider.php” $json = str_replace( 'window._sharedData = ', '', strstr( $response['body'], 'window._sharedData = ' ) );
    It is because your code assumes that wp_remote_get() returns an array of arrays. But as we can see in docs it may return WP_Error object as well –
    Is there any public repository when I may submit fix for this?

    Thank you,

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,
    I experienced the exact same problem, after moving a website to a different server.

    @limestreet : could you share here your fix?

    Thank you.

    Thread Starter Patryk Kachel


    You need to modify plugin files directly, I don’t think it’s good idea…
    Before using $response as an array you need to check if it is an array.

    First, one step back. On the front-end, my issue is this message:

    “No images found!
    Try some other hashtag or username”

    When using hashtags, it works. With username (exactly the same of the previous server – where it was doing fine) it does not.

    Is that PHP fatal error the likely cause?

    Thread Starter Patryk Kachel


    I have no idea is it related or not. It require debugging.

    @limestreet Thank you for that. I didn’t have that reported before but will issue a fix for that on the next release.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Cannot use object of type WP_Error as array’ is closed to new replies.