scottsweb / wp-instagram-widget

❌ A WordPress widget for showing your latest Instagram photos.
115 stars 62 forks source link

Instagram has returned invalid data. #93

Closed leowebguy closed 6 years ago

leowebguy commented 6 years ago

Message is coming from the last statement below. Am I missing something?

if ( isset( $insta_array['entry_data']['ProfilePage'][0]['user']['media']['nodes'] ) ) { $images = $insta_array['entry_data']['ProfilePage'][0]['user']['media']['nodes']; } elseif ( isset( $insta_array['entry_data']['TagPage'][0]['graphql']['hashtag']['edge_hashtag_to_media']['edges'] ) ) { $images = $insta_array['entry_data']['TagPage'][0]['graphql']['hashtag']['edge_hashtag_to_media']['edges']; } else { return new WP_Error( 'bad_json_2', esc_html__( 'Instagram has returned invalid data.', 'wp-instagram-widget' ) ); }

scottsweb commented 6 years ago

Not sure I follow what you are saying. This is indeed the code that is generating the error - that is clear as it is the code I wrote and open source. What we don't know is why Instagram are rejecting some requests. In order to understand that we need to see the full response from Instagram. As discussed here:

https://wordpress.org/support/topic/inconsistent-200-error-with-latest-version

We need to print the full response headers from Instagram.

Modify this line:

https://github.com/scottsweb/wp-instagram-widget/blob/master/wp-instagram-widget.php#L212

Add a print_r( $remote ); above it and paste back the output here. That will contain more valuable info.