BACK TO DIRECTORY

Require Auth Users REST Endpoint

by Sal Ferrarello

0.0
(0 ratings)

This plugin modifies the /wp-json/wp/v2/users endpoint to require authentication.

By default on a WordPress site you can list the users that have posted content on the site by visiting this endpoint.

This plugin requires the user to be authenticated to view the list of users.

What this means

If you go directly to the URL /wp-json/wp/v2/users you will get a 401 Unauthorized response.

But if you open a block editor page and run the following from the browser console,

await wp.apiFetch({path: 'wp/v2/users'});

you will get a list of users (because the wp.apiFetch() function authenticates the user’s call to the WordPress REST API).

Author

Sal Ferrarello / salferrarello.com

Plugin Details

Active Installs
30
Total Downloads
1,321
Version
1.0.0
Requires WP
6.5
Requires PHP
7.2
Tested Up To
6.9.7
Added
2024-07-30
Last Updated
2026-01-13 2:22am GMT

Ratings

5
0
4
0
3
0
2
0
1
0