I done a bit of experimenting and in my custom endpoint i replaced :
wp_send_json($items);
with :
return new \WP_REST_Response ($items);
However I do not see how to extract my data from the WP_REST_Request object. I can see it is there with var_dump. But I can find no documentation as to how to access the data. This started because of a Question in the WordPress REST handbook suggests you can access REST endpoints from PHP within a plugin. I though it would be better than directly accessing the DB. But I’ve wasted enough time.
Related Posts:
- Does something like is_rest() exist
- WP REST API — How to change HTTP Response status code?
- WP REST API Is it rather easy to rename the default wp-json uri part?
- Search WP API using the post title
- Displaying a page built with Elementor using the REST API [closed]
- Understanding SHORTINIT with WordPress 5
- wordpress wp-json prefix issue
- Filter post_content before loading in Gutenberg editor
- Create post using rest api with html content
- rest_post_query on multiple post types?
- Wp Rest Api Custom Endpoint for page subpages
- How should an old API version be deprecated gracefully?
- Full page NGINX (or Cloudflare) caching and WordPress nonces
- WP REST API returns incorrect data?
- WP 5.5 Fatal Error – get_rest_controller() in rest-api.php
- REST API GET users
- Display post title from WordPress excluding a string via API
- WP_REMOTE_POST Requests are being blocked by API provider [closed]
- wp_get_object_terms() returns invalid taxonomy inside rest_api_init hook
- Is it posible to use wp.data.select(‘core’) outside a block?
- Can you Use the Rest API to query a custom database table
- Is there anyway to format my EndPoint URL in WordPress?
- Return WP_Error as WP_REST_Response
- Authenticating with REST API
- Make authorization mandatory on custom routes
- Why the Path is different with the one coded in rest
- Custom Rest API POST endpoint with conditionally required parameters
- What is the meta field in the response of the user REST API?
- Is there any way to clear cache when making REST API request?
- how to avoid timeouts with remote API requests?
- Custom API endpoint to create gallery for post
- Register REST route with a multi-value parameter
- How do I add meta when creating a post with rest api?
- WordPress + REST API v2 and private pages Load by slug
- Change permissions on REST api?
- PHP: authenticate for a REST request?
- Is it Ok to restrict Access-Control-Allow-Origin for /wp-json requests?
- Validate rest-api call on create
- If I use WordPress REST API V2 and someone makes an app using it. Will my site count the posts views from the APP? And if not, then how?
- How to store and return json in a (custom) post meta field
- Sorry, you are not allowed to list users
- Authenticate current user to REST API
- Get a remote post ID via API given URL
- rest api endpoint – accept diacritic characters
- Core function to check if a rest namespace exists
- WordPress REST API rest_comment_invalid_author Sorry, you are not allowed to edit ‘author’ for comments
- How to delete user using rest api without reassigning
- How to change the date and time in REST API for comments?
- Rest API V2 custom post type. I only need the title and link
- Retriving all users with REST API not working
- Is there a way to download only the Rest API part of WordPress?
- Custom WP API endpoint NULL body data
- Accessing private posts through REST API, same code that works in remote doesn’t in local
- What is an endpoint for custom post type comments in REST API?
- Rest API: trouble receiving response through script (browser and Postman display correctly)
- Advanced Access Manager: RESTful endpoint to refresh token
- `WP_REST_Controller::get_endpoint_args_for_item_schema` Does Not Set `required` Property from Schema
- Extending REST API responses
- Error message: Response is not a valid JSON response
- How to use query parameters, as “_fields”, to filter data inside an array in the REST API?
- WordPress server banning IP
- How to display relations via wordpress Rest API
- How to add Relations of a CCT from JetEngine via WordPress Rest API
- Fetching WordPress Private Posts, Public Posts Via Default REST API Endpoint
- Pass multiple tags slug to rest API
- Return a WP_REST_Response from an inner function (and not from the root callback)
- register_rest_route with method POST but in wp-json/ is showing GET
- wp_nonce vs jwt
- Rest Api fetching only one random post
- WP Rest API in Android studio does not show Images
- Got Blank issue for get data from /wp-json/v2/post
- How do i POST to WordPress rest API from the same domain?
- WP API file_get_contents return TTP request failed! HTTP/1.1 401 Unauthorized
- Not able to delete media by REST API
- Update membership level via API request if using simple membership plugin
- Need to get user data via API
- REST API retrieving posts from www.sitename.com/category/news/ instead of just just from www.sitename.com
- REST API get featured image source for custom post type
- Custom rest API route not passing data along
- Rest API encoding of double quotes
- How to filter wp-json/wp/v2/users response on custom metas?
- Paid membership Pro Rest API
- wp_query json ouput
- GET request for media files in WP REST API 2 results in an empty array
- Fatal error: Call to undefined function register_rest_route()
- WordPress REST API not displaying all information
- Create a new page on front page for logged in user
- API wp-json/wp/v2/pages/ returns a different result if page is specified
- In Rest API 2.0 is it possible to get some meta fields but not others?
- Is my WordPress site handing out sensitive information/misconfigured?
- Delete row from table using custom endpoint via API
- Fetch post by author slug
- Cant POST with REST API on WordPress
- How can I set the default ‘orderby’ and ‘order’ parameters for a REST API call?
- get the current logged in user using WooCommerce API in React App [closed]
- Problem with custom WordPress Rest API search route with query parameters
- What filtering is available for backbone.js?
- How to limit what fields are returned through the WP API Backbone JS client
- Woocommerce API for calling products by Category ID
- wordpress rest api authentication failed