Retriving all users with REST API not working

Question

At the moment I’m using Postman to hit the endpoints and I have a successful Basic Authentication but so far I’m unable to get all the registered users.
My request:

https://example.com/wp-json/wp/v2/users

returns only users that have posts even though I have inserted:

add_filter( 'rest_user_query' , 'custom_rest_user_query' );
function custom_rest_user_query( $prepared_args, $request = null ) {
  unset($prepared_args['has_published_posts']);

  return $prepared_args;
}

in my functions file.
I have also tried applying a filter:

https://example.com/wp-json/wp/v2/users?filter[per_page]=0

But I still get the same result: Only users with posts.
I have been banging my head on for days now…

0
A.M.P. 3 weeks 2021-09-30T03:55:18-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse