Hi there,
This problem occurs because of limited API request to/from Instagram API server. Please use widget caching plugin to solve this temporarily.
I’m still in developing stage on caching feature.
Cheers!
Hi,
Thanks for indicating WP Widget Cache.
Got the same error, here’s a bugfix for simply-instagram-functions.php line 187
/**
* Get the most recent media published by a user.
*/
function sInstGetRecentMedia( $user_id, $access_token )
{
$apiurl = "https://api.instagram.com/v1/users/" . $user_id . "/media/recent/?access_token=" . $access_token;
$response = wp_remote_get( $apiurl );
if(is_array($response) && array_key_exists('body', $response))
{
$data = json_decode( $response['body'], true );
return $data;
}
else
{
return FALSE;
}
}
I think there is a better solution for this, according to the wp_remote_get() documentation: http://codex.ww.wp.xz.cn/Function_API/wp_remote_get#Examples
$data = array();
$response = wp_remote_get( $apiurl );
if (is_wp_error($response)) {
$data = json_decode( $response['body'], true );
}
I have a similar situation, looks like it may be the same core reason, but not sure:
Fatal error: Cannot use object of type WP_Error as array in /usr/www/users/xnhhwr/ttp/wp-content/themes/kallyas/admin/framework/class-envato-protected-api.php on line 344
Any help is greatly appreciated.
Thank you in advance.
William
I’m getting the same error as the original poster. Quite unfortunate. This seems like it would be a really good plugin if it worked π
I tried the fixes mentioned above, but then the plugin doesn’t output anything. I got the WP Widget Cache plugin. What should I enter for the number of seconds until it expires? I’m trying different values but to no avail.
@spencer: As per the Forum Welcome, please post your own topic. This one is 3 months old.
Thank you @johann Wagner. Your solution worked here
Hi All,
I’m getting the same problem after checking the box onmy tjeme for updates and adding an API I randomly got from Envato. When I try to login to wordpress I receive the following:
Fatal error: Cannot redeclare class Envato_Protected_API in /home/web7day/public_html/adoptoursoldier.com/wp-content/themes/alterna/envato-wordpress-toolkit-library/class-envato-protected-api.php on line 13
Can sonebody please help…I need to get into the site, thanks.
Richard
@richard – your issue is not related to this plugin at all. Please start your own topic.
Hi WPyogi,
I’m new to this. I searched for “API – cannot declare”, and I was sent to this group. I’ll look around, thanks for responding.
Richard
Here is a great article by Yoast and most likely the best approach to checking for an error on $response
http://yoast.com/wordpress-http-api/
if ( 200 == $response['response']['code'] ) {
$body = $response['body'];
$data = json_decode( $response['body'], true );
}
However check out the article as it gives other approaches as well =)
Same issue here, cropped up out of the blue and prevented all other widgets from loading.
WP Widget Cache did not help
@johann Wagner Solution did work. Thanks!
maybe the issue in timeout, add this script on plugins :
function wpdocs_extend_http_response_timeout( $timeout ) {
return 30; // seconds default wordpress is 5
}
add_filter( 'http_response_timeout', 'wpdocs_http_response_timeout' );
hope this help…
@dodi ^
thanks, that helped me on a different project! Cheers!