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
- Reduce nonce lifespan
- Add Products to user’s ID Woocommerce
- Store post in raw markdown format, no html?
- Multisite functions to communicate with individual site functions
- Show the “ratingValue” and “ratingCount” values of KK Star Ratings Plugin
- REST-API: extend media-endpoint
- 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?
- Remove caching from wp_remote_get calls from custom plugin
- 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
- How to display the “ratingValue” and “ratingCount” values generated by the KK Star Ratings plugin into my page’s recipe ld+json schema
- wp_get_post_terms is difference obj model than the one in rest api response
- wordpress json api not working
- How to use JSON data from URL into table on my wordpress website
- wp_remote_get() returns 403 while file_get_contents() does not
- AJAX in plugin wp_send_json() sending html
- Ability to make API calls out of WordPress as well as executing SQL?
- Access WordPress data from external PHP application.
- Ajax with plugins returns 0
- Blog titles from WP blog on plain html site?
- Set plugin-values when creating post via REST-API
- how to do login using woocommerce rest api From android
- AFNetworking incorrectly interpreted WP_Error
- Access WP_REST_Server from within plugin namespace
- REST route from a plugin not working if WordPress is installed in a subdirectory
- Plugin retrieving results even after uninstallation
- Getting a Page via its post-name using WP REST API v2 and Postman
- WordPress REST API Plugin Development – Add Custom Endpoint
- How to create WordPress custom end point with multiple parameters?
- How to execute plugin and theme updates from a web hook / endpoint?
- 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?
- Custom API plugin to execute 3rd party API to retrieve data
- URL rewrite with external JSON query
- WordPress /users/me endpoint request forbidden
- Call Ajax URL in Plugin
- Seperate plugin and theme files
- wc_get_template_part doesnt display the content [duplicate]
- WordPress REST API: Query media files attached to a custom post type
- Upload Javascript and json webpage to wordpress
- How to add a PW Gift Card to a Woocommerce Order request API?
- How to send the featured image of a post to an API?
- In a plugin, How to update a json file using ajax
- How to authenticate via API to allow writes/updates
- Do i need to use a plugin for third party api integration?
- Adding Custom Endpoint in WordPress Rest API
- How to use Datatable with Ajax when creating plugin on WordPress?
- Getting all woocommerce products from REST API call in plugin
- Hide response returned from WordPress REST API call
- How much PHP and MySQL or MariaDB knowledge should I know to start writing WordPress themes and plug-ins and whatever else a beginner can edit?
- How achive serving multiple concurrent Ajax / Rest calls in plugin?
- WP Rest Api GET method restriction on route, but POST method also works
- Showing how many times is plugin activated or deactivated
- Modifying server’s response to API endpoint
- Is it possible to custom set query for a WordPress REST API response?
- How to get data from a private API and add it to wordpress pages
- Plugin json page
- Fetching users data from REST API
- Consume legacy rest api dependent upon WP API plugin
- API page return Header 500 but Work
- Fetching WP.me shortlinks for posts using WP Rest API
- 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
- Ajax specific template not loading in replacement of index.php
- 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
- Output pure JSON wordpress
- Undefined property: stdClass::$ AND Trying to get property ‘name’ of non-object Error in plugin
- 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
- WordPress REST API filter on blank custom ACF
- WooCommerce REST API aborts connection [closed]
- 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