{"id":11094508,"date":"2019-01-16T08:38:57","date_gmt":"2019-01-16T08:38:57","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/cannot-use-object-of-type-wp_error-as-array-10\/"},"modified":"2019-01-16T08:38:57","modified_gmt":"2019-01-16T08:38:57","slug":"cannot-use-object-of-type-wp_error-as-array-10","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/cannot-use-object-of-type-wp_error-as-array-10\/","title":{"rendered":"Cannot use object of type WP_Error as array"},"content":{"rendered":"<p>Hi,<br \/>\nI get &#8220;Cannot use object of type WP_Error as array&#8221; on line 971 in file &#8220;\/instagram-slider-widget\/instaram_slider.php&#8221; <code>$json = str_replace( &#039;window._sharedData = &#039;, &#039;&#039;, strstr( $response[&#039;body&#039;], &#039;window._sharedData = &#039; ) );<\/code><br \/>\nIt is because your code assumes that <code>wp_remote_get()<\/code> returns an array of arrays. But as we can see in docs it may return <code>WP_Error<\/code> object as well &#8211; https:\/\/developer.wordpress.org\/reference\/functions\/wp_remote_get\/<br \/>\nIs there any public repository when I may submit fix for this?<\/p>\n<p>Thank you,<br \/>\nPatryk<\/p>\n","protected":false},"template":"","class_list":["post-11094508","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/11094508","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/11094508\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=11094508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}