Filter posts by multiple custom taxonomy terms using AND operator in REST API v2 (WordPress)

I think I know the fix. I noticed that the plus sign (+) in the url arguments was automatically being stripped and converted into a space. My arg values ‘august+september’ were becoming ‘august september’ after decoding. I found out that ‘%2B’ is the code equivalent of the + symbol. So, instead of using: /wp-json/wp/v2/events?filter[event_categories]=august+september Use: … Read more

How to define a query parameter with REST API?

Yes, from the link you posted there are examples for both sanitising and validating the parameters. Validating does a check which can fail and block the API call from running; sanitising just does some operations to clean or interpret the parameter and does not stop the API call from running. An example of validation, taken … Read more

Including WordPress in RESTful API

The credit for this answer really goes to @Wyck who correctly identified the source of the problem. Thank you very much. The reason for the problem is: There is a variance between an import statement in the mainline code versus within a function. In WP or in in any of the plugins if variables aren’t … Read more

Retrieving pages with multiple tags using REST API

I ran into the same problem but for posts. I found how to OR or AND tags together here: https://codex.wordpress.org/Class_Reference/WP_Query#Tag_Parameters To get entries that have both L1 AND L2 AND L3 ; use plus (+) https://example.com/cms/wp-json/pages?filter[tag]=L1+L2+L3 In case somebody else comes along and wants to OR terms together I’ll save you the trouble: To get … Read more

How do I Filter Custom Post Type by Custom Taxonomy in the newest WordPress RESTful API?

We can check out the /wp/v2/clock endpoint’s arguments here: https://myapp.dev/wp-json/wp/v2/ If we add the ‘show_in_rest’ => true, argument, when registering the custom clock_category taxonomy, it will add a support for this GET/POST argument: clock_category: { required: false, default: [ ], description: “Limit result set to all items that have the specified term assigned in the … Read more

Retrieve all users from wordpress database via REST/JSON API

Thanks to stackoverflow user Milap ! You can get all users even they have not created any post, for that you need to modify rest-api plugin. Open wp-content/plugins/rest-api/lib/endpoints/class-wp-rest-users-controller.php file, you will find below code on line number 106, if ( ! current_user_can( ‘list_users’ ) ) { $prepared_args[‘has_published_posts’] = true; } Change it to below, if … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)