Your logic for your updated if statement is wrong.
if( !is_wp_error($response) && $response['response']['code'] != 200 )
Here you are saying; if NOT wp_error AND response code NOT 200 return false. So your not actually catching the WP_Error
I believe what you are after is something like:
if ( is_wp_error($response) || $response['response']['code'] != 200 ) return false;
IS wp_error OR code NOT 200
Related Posts:
- How to check if wp_update_post was successful
- How to make Http Request to a php file present in plugin directory of wordpress
- Cache WP remote_get HTTP Response using Transients
- How can I add hyperlink in WP_Error message?
- How to make a implement queue for scheduling tasks in WordPress?
- WP_Error with multiple form validation message
- Get errors from WP_Error to different variables
- http_response_timeout filter not working
- plugin generated unexpected output during activation, but it is empty
- Need help creating asynchronous data scraper in WordPress
- “Welcome to WordPress” Plugin Required Error
- I can’t view the orders on the woocomerce dashboard with the brainblocks plugin
- How do I create a state of “don’t assign anything to variable” if WP_Error throws an error?
- How to use wp_http with https-pages?
- WP Elementor Pro causing crtical failure on website
- Changing the “Plugin Activated” Message Default
- Is there a StackExchange-like voting plugin for WordPress? [closed]
- How can I prevent a plugin from updating unless it’s minimum PHP version is met?
- wp_enqueue_scripts not working in custom theme
- What characters are allowed as a shortcode tag and how should they be sanitized?
- How Do I Use The WordPress Plugin Posts 2 Posts by Scribu?
- Notify Admins about Plugin Merge
- Additional, optional fee on Woocommerce Checkout [closed]
- Why does including a file in theme’s functions.php not work?
- While using WordPress Multisite is it possible to display data to main site from subsites?
- OEmbed from Pinterest
- disable active plugins for specific theme
- Flickr plugin that will display photos from multiple group pools? [closed]
- Generate JWT Token without username and password
- WordPress web page struggling with performance
- Making menu link open in new tab?
- ReOrder Post Within Categories plugin with featured image
- How to initialize something in unit test before the init hook being called?
- add_filter comment_edit_redirect not working
- Global matrix for shortcodes/content for every page
- How to write a plugin to add users to a mail list
- Use the page title in the plugin
- Two text domains in one plugin
- Cron job not firing
- See which user installed a plugin?
- Plugin or method to delete uploads not in media library?
- Add woocommerce variation images in gallery?
- Add a CSS class based on categroy id to archive pages
- Add button gutenberg help
- How to add media field to WP_Widget form function?
- Comment section not showing correctly
- add input in custom javascript from WordPress pages/posts
- DOMAIN_CURRENT_SITE constant being regularly overridden [closed]
- Troubleshooting Plugins.php HTTP install path vs. a HTTPS for a single Plug-In
- Save values from a pre_post_update
- How to let user store a file in plugin directory but not have it get deleted on update?
- Anyway to convert a plugin to become a shortcode?
- ‘Organize Series Plugin’ as muti author feature
- Suggestions for Dressing up blog for the holidays
- Prevent direct access to WordPress plugin assets?
- Allow only Admin role to access plugin settings/options page
- Change the style of h1, h2, only in post entry
- How to reset the plugins without deactivate the plugin
- plugins_url() works everywhere but wp_reqister_script()
- Better WP Security : dashboard doesn’t work any more
- Elementor page builder plugin not loading up all the way? [closed]
- show my own admin_notices after a post has been published
- Play videos with buffering in my server
- Custom form not showing in correct place on page
- WooCommerce Hiding A Certain Category From Being Displayed On Single Product
- Editable select options in quick edit OR in plugin settings
- Send Array from JS to php file then insert it in wp database through a plugin
- Offer Download Links for Product Images
- How to override Plugin javascript function : $(‘body’).on(‘change’,’.class’)
- Connect / Login WordPress Hosted Website or Blog with NodeJs
- Copy/paste local images not working in WordPress
- insert data from textbox to database
- How to change the WordPress Plugin Watson Assistant Chatbot BOX Size?
- White Screen of Death
- Plugin updates, change file permissions on WordPress
- Creating one user access account for all the multiple sites
- I am Getting Sorry, no posts matched your criteria on form submit only for certain page [duplicate]
- Plugin information tabs show large blank area at top
- Custom role not listed
- How to fix blog article view and share #’s?
- Is it possible to “include” another wordpress post/page?
- WordPress SSO SAML
- Modify Plugin shortcode function code
- Attachments plugin cannot click media library button [closed]
- Is there any hook to change media html in post? [duplicate]
- plugins_loaded action is not working properly
- Creating a user ‘add custom field’ section
- WordPress Settings – Custom Button actions
- Javascript not working
- Links on FAQ page aren’t working
- How to show post attachment image
- How can I make the Twitter Tools plugin hyperlink every link?
- WordPress shortcode plugin not working
- FacetWP: Plugin breaks button/modal functionality inside searchable content area
- Undefined property: stdClass::$ AND Trying to get property ‘name’ of non-object Error in plugin
- get_option returning a different value from what’s saved
- How to import data from another website using an API link?
- Meta box not displaying on the plugin page
- Warning: Undefined variable $admin
- plugin translation *.mo file not getting loaded for custom post