Created
January 5, 2017 17:03
-
-
Save gilzow/3b000f07aca9218a505a4827ad002154 to your computer and use it in GitHub Desktop.
Removes user endpoints from WordPress REST API
This file contains 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 | |
/** | |
* Remove user list endpoint from rest api | |
*/ | |
add_filter('rest_endpoints', function($aryEndpoints){ | |
if(isset($aryEndpoints['/wp/v2/users'])){ | |
unset($aryEndpoints['/wp/v2/users']); | |
} | |
if(isset($aryEndpoints['/wp/v2/users/(?P<id>[\d]+)'])){ | |
unset($aryEndpoints['/wp/v2/users/(?P<id>[\d]+)']); | |
} | |
return $aryEndpoints; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works perfect, thanks!