Skip to content

Instantly share code, notes, and snippets.

View gilzow's full-sized avatar

Paul Gilzow gilzow

View GitHub Profile
@gilzow
gilzow / put-inside-functions.php
Created January 5, 2017 17:03
Removes user endpoints from WordPress REST API
<?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]+)']);