How can I return only IDs from the `posts` REST endpoint?
How can I return only IDs from the `posts` REST endpoint?
How can I return only IDs from the `posts` REST endpoint?
You shouldn’t link directly to plugin/theme PHP files to handle requests for this exact reason – the WordPress environment won’t be loaded, hence your undefined function error. Since you’ve implemented a shortcode-approach to integrate with the theme, you could just point the form to itself (i.e. remove the action attribute) and then dynamically handle the … Read more
Flatten Responses returned via WP REST API via WP_Error for obfuscation
What’s wrong with my call to register_rest_route() ? Is it the way I’m trying to access it? This is the correct way to access that endpoint: The route I’m trying to access is http://site.test/wp-json/mchs/v1/search/[email protected] But then you’re getting the 404 error because the path variable in the second parameter below, is not in the correct … Read more
One way that comes to my mind is to define your own custom routes for the API, allowing it to send results based on the route or use the same route with different GET params. OR based on the way you’re going with, you could probably send some GET params to the url and do … Read more
As of WordPress 5.5, register_rest_route()‘s permission_callback argument is required. You should be receiving/logging an error message to the effect of PHP Notice: register_rest_route was called incorrectly. The REST API route definition for /search-cert is missing the required permission_callback argument. For REST API routes that are intended to be public, use __return_true as the permission callback. … Read more
WordPress custom REST API: How to validate input data by many context?
Cant create or update meta fields using WordPress REST API
WP Rest API – Change response status code for failed validation request
Terms added to custom taxonomy for custom post type only appear in Rest when added in code