New answers tagged

1

You should use cookie based authentication instead of basic auth. Delete the basic auth/application password authentication code. Follow the cookie authentication example that creates a post via the REST API from the REST API handbook: https://developer.wordpress.org/rest-api/using-the-rest-api/authentication/#cookie-authentication Create a valid nonce for ...


0

The author parameter in your request, seems to be mapped to the author__in parameter in WP_Query that runs behind the rest-api call here, where a comma separated input: /wp-json/wp/v2/posts?author=1,5 is translated to an array( 1,5 ) input for author__in.


0

In order to accomplish this, I created a custom data store and extracted the available meta keys from the routes object returned when hitting the wp-json/wp/v2/ endpoint in the editor. This approach decreased the number of API requests compared to that with which I started. The initial approach in the question would have made one call per block vs one per ...


0

You need to add the following line to your ajax call: xhrFields: { withCredentials: true }


0

So it turns out this was completely changed in 5.7 and the documentation has, unhelpfully, not been updated to reflect that. More info in the Git commit. Instead of: /wp-json/wp/v2/posts?tags=22,23&tax_relation=AND This URL works: /wp-json/wp/v2/posts?tags[terms]=22,23&tags[operator]=AND


0

It has just worked with the rest api v1 for me. The v2 declined the callback permission for selecting the table results. Here is an example endpoint for fetching from custom db table: domain.com/wp-json/test/v1/testing add_action( 'rest_api_init', function () { $namespace = 'test/v1'; $route = '/testing'; register_rest_route($...


Top 50 recent answers are included