1add_filter( 'rest_endpoints', function( $endpoints ){
2 if ( isset( $endpoints['/wp/v2/users'] ) ) {
3 unset( $endpoints['/wp/v2/users'] );
4 }
5 if ( isset( $endpoints['/wp/v2/users/(?P<id>[\d]+)'] ) ) {
6 unset( $endpoints['/wp/v2/users/(?P<id>[\d]+)'] );
7 }
8 return $endpoints;
9});
10