PHP Error "Cannot use object of type WP_Error"

I got this error and my page breaks completely :frowning:

Fatal error: Uncaught Error: Cannot use object of type WP_Error as array in root/dev.mydomain.com/wp-content/plugins/patreon-connect/classes/patreon_api.php:44 Stack trace: #0 root/dev.mydomain.com/wp-content/plugins/patreon-connect/classes/patreon_api.php(15): Patreon_API->__get_json(‘current_user’) #1 root/dev.mydomain.com/wp-content/plugins/patreon-connect/classes/patreon_wordpress.php(74): Patreon_API->fetch_user() #2 root/dev.mydomain.com/wp-content/plugins/patreon-connect/classes/patreon_wordpress.php(95): Patreon_Wordpress::getPatreonUser(Object(WP_User)) #3 root/dev.mydomain.com/wp-includes/class-wp-hook.php(286): Patreon_Wordpress->updatePatreonUser(’’) #4 root/dev.mydomain.com/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array) #5 root/dev.mydomain.com/wp-includes/plugin.php(453): WP_Hook->do_action(Array) #6 root/dev.mydomain.com/wp-i in root/dev.mydomain.com/wp-content/plugins/patreon-connect/classes/patreon_api.php on line 44

Hey @sekra24!

Thanks for bringing that to our attention. I’ll discuss this with the team and we’ll get you an update as soon as we have had a chance to review.

1 Like

This error happens when WP is not able to contact Patreon API and WP returns an error instead of the API call result.

Have you entered all your credentials correctly, without spaces?

@nperickson @codebard This was a temporary issue. I think patreon was maintaining their API so the connection could not be established. Mybe it would be better to handle the error any other way because I don’t want my site broken everytime patreon updates their API :smiley:

You know what I mean? Greetings

1 Like