wp_remote_get return array of results containing keys body, headers, response etc depending on arguments.
And json_decode only accept JSON string. So correct your code in this way
//return if not an error
if ( ! is_wp_error( $response ) ) { //decode and return
return json_decode( wp_remote_retrieve_body( $response ) );
}
Related Posts:
- WP Rest API: details of latest post including featured media url in one request?
- Building a custom REST API
- WP JSON REST API (Ryan McCue) how to query posts with specific meta data with ‘AND’ relation?
- Keep user’s privileges on accessing contents in JSON response
- I’m receiving the following error using the below code: Uncaught Error: Cannot use object of type WP_REST_Response as array
- WordPress output data to another website and pull data
- CRUD from WordPress to Business Central 365 through OData REST API
- WordPress PHP error getting posts from another wordpress blog
- WP Rest API v2.0 user profile update issue
- how to know that a wordpress plugin support using API?
- To Disable WordPress Rest API or Not To Disable?
- How to create gutenberg block using REST API independently or as headless way?
- Filter out results from REST API
- How to authenticate custom API endpoint in WooCommerce [closed]
- WordPress pods io – Rest API for fetching fields information for custom post type
- WordPress wp-json API – Custom Post Type returns 403
- Reduce nonce lifespan
- Add Products to user’s ID Woocommerce
- Multisite functions to communicate with individual site functions
- Show the “ratingValue” and “ratingCount” values of KK Star Ratings Plugin
- Accessing plugin functionality within WP REST API
- How to get all events from ‘All in one Events calender’ plugin in JSON format?
- Permission Check for REST API Endpoint Runs Twice?
- How to retrieve custom meta term of category taxonomy from WP Rest API?
- Remove caching from wp_remote_get calls from custom plugin
- Where to access the available plugin/WordPress updates?
- I am getting error message on accessing menu-endpoint
- How can I capture Memberpress user info after signup [closed]
- Detect permalinks when passing querystring in REST API requests
- Custom REST API endpoint returns rest_no_route when called via wp-json permalink
- CMB2 Repeatable Group & JSON API
- WordPress JSON API remove posts from a specific category
- How to save generated JWT token to cookies on login?
- wp_get_post_terms is difference obj model than the one in rest api response
- How to modify WCMP Rest API response?
- wordpress json api not working
- AJAX in plugin wp_send_json() sending html
- Access WordPress data from external PHP application.
- Limit post creation by role
- Blog titles from WP blog on plain html site?
- how to do login using woocommerce rest api From android
- Access WP_REST_Server from within plugin namespace
- Prevent plugin from intruding on wp-json posts api
- Plugin retrieving results even after uninstallation
- Create WordPress posts from JSON array using plugin in admin
- Adding inside wp-plugin jQuery script that receives JSON-formatted data, generated by php-function inside this plugin
- How to create WordPress custom end point with multiple parameters?
- How do I make reusable content blocks for header and footer when using WordPress headless with another front-end?
- REST API can’t get the response manually
- How to integrate together a website currently hosted WordPress.com and a custom web application currently hosted on Azure?
- Call Ajax URL in Plugin
- Change Dashboard URL from wp-admin to wp-admin/index.php
- WordPress Media Library Folders + Custom Linux Server Hosting
- Upload Javascript and json webpage to wordpress
- How to send SMS notification to customer after click on submit?
- How to send the featured image of a post to an API?
- Escape commas in REST API
- Adding Custom Endpoint in WordPress Rest API
- One WooCommerce Store to multi distributor sites
- How to use Datatable with Ajax when creating plugin on WordPress?
- Custom REST API POST Endpoint Not Working, 404 Error
- is it possible to fetch data from a remote api while admin is writing a new post?
- add tags to wordpress post using REST API
- Hide response returned from WordPress REST API call
- How achive serving multiple concurrent Ajax / Rest calls in plugin?
- Showing how many times is plugin activated or deactivated
- Modifying server’s response to API endpoint
- Can’t access 3rd party API, code works on local server but not on wordpress
- How can I add a permissions callback to the REST API index pages?
- How to get data from a private API and add it to wordpress pages
- Fetching users data from REST API
- Consume legacy rest api dependent upon WP API plugin
- wp rest api (v2) filter not working (404 error – rest_no_route)
- API page return Header 500 but Work
- custom REST endpoint not passing body of POST request to callback
- Upload image to wordpress using ionic/cordova with WP REST API V2
- Populate select option with JSON file
- Sending post data over REST API, how to parse shortcodes in post_content?
- How to do rest APi with wordpress
- JSON Feed on my wordpress Blog
- Extend WordPress REST API with Scheme Pro Plugin
- Plugin Admin Page Ajax-Admin call returning 0, URL set correctly. Implemented localized scripts but did not fix it
- wordpress plugin JSON API search within specific category
- wordpress Ajax success doesn’t return the value
- How can I send api calls from my plugin?
- Filter custom post type returned from REST api
- My wp_update_nav_menu action is firing twice
- WordPress REST API Visual Composer Shortcodes
- Update post meta Rest Api
- Is option_active_plugins actually doing anything useful?
- WordPress REST API filter on blank custom ACF
- How to update a lot of posts on my WP site with additional content?
- how to update WordPress plugins from external website with nodejs?
- Stop the user if login from the cookies
- Is it a good idea to restrict the REST API
- REST API – filters not working inside plugin class
- ImageMagick on wordpress 6.5.5 for Linux Alma 8 success but which no magick
- i need to resive data external api and show user
- Can The REST API be used to create/edit plugins and themes?
- How prevent STDOUT of Plugin_Upgrader->upgrade(…)?