Created
February 9, 2022 16:13
-
-
Save Tmeister/cbda43b8003a3b80a1ec0d400116cc0b to your computer and use it in GitHub Desktop.
Disable Users endpoint on the WP REST API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('rest_endpoints', function ($endpoints) { | |
if (isset($endpoints['/wp/v2/users'])) { | |
unset($endpoints['/wp/v2/users']); | |
} | |
if (isset($endpoints['/wp/v2/users/(?P<id>[\d]+)'])) { | |
unset($endpoints['/wp/v2/users/(?P<id>[\d]+)']); | |
} | |
return $endpoints; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment