Are you trying to use that function without first initiating it in an action? It should be done like so:
add_action( 'rest_api_init', 'add_custom_users_api');
function add_custom_users_api()
{
register_rest_route( 'route', array(
'methods' => 'GET',
'callback' => 'function',
));
}
Related Posts:
- Rewrite /?rest_route=/ link to /wp-json/ without changing default permalink structure in apache
- Case insensitive header params for API request
- Allow REST API over HTTP, the rest of the site forced to HTTPS
- Best collection of code for your .htaccess file [closed]
- Stop WordPress and Plugins from Overwriting .htaccess
- Htaccess for Wordpess set on single subdomain
- WordPress + Magento .htaccess ReWriteRule Issue (www vs. non-www)
- Blog.php or how to display recent posts?
- Admin-Ajax.php, SSL, Non-SSL
- WordPress site displaying 404 for any page apart from index
- How to avoid wordpress permalink rules to inherit in a sub-folder
- Cant block wordpress readme files
- Using WordPress only for the backend, and using AngularJS as a frontend
- .htaccess for wordpress in separate folder
- WordPress mod_rewrite is canceling/overwriting my other mod_rewrite rule
- .htaccess and WordPress Admin Bar
- Struggling with add_rewrite_rule
- Giving WordPress its own subdirectory – nginx
- Question with loading 403/ 404 error pages and htaccess
- How can I make an htaccess file on a Mac? [closed]
- Why does a directive only work when it is included inside WordPress directives?
- .htaccess password protect all but one page
- WordPress overrides custom 404 page with it’s own
- How to fix category url 404’s after category permalink change
- WordPress: Adding Security
- How can I fetch the content of a post of my wordpress domain from an other domain?
- Redirect Specific Wildcard Subdomain to a specific URL on another domain
- WP install in sub-dir white screen
- 301 Redirect domain Sub-folders to Subdomain subfolder
- WordPress not seeing .htaccess rules
- Override 404 page with htaccess
- Htaccess Rewrite reverts to default .htaccess file
- create a static folder independent with WordPress
- WordPress site not working after move
- what could cause the htaccess file to be modified?
- change permalink structure with htaccess without SEO impact
- Site in subfolder – all pages work except home
- Giving to wordpress it’s own directory cause login loop
- Directing subdomain to main domain and keeping the subdomain format with .htaccess
- Remove /sites/25/ from image URLS
- htaccess, site and staging in subdirectories
- How disable canonical redirect wp-signup
- WordPress sites in subfolders
- Admin Panel Slowdown After SSL Verification
- WordPress category with 404 error
- where to add redirection rewriterule in .htaccess file?
- Trouble adding directory rewrite to htaccess under wordpress [closed]
- How do I apply friendly URL permalinks to a custom WordPress template?
- create virtual subdomains for a bunch of urls on a site via .htaccess
- htaccess getting overwritten over and over = 404 error
- htaccess problem not being able to overwrite previous rules
- wordpress blog displaying blank pages [closed]
- Relative links stop working after moving wordpress site from hosting to localhost
- WordPress site blacklisted by Google about .htaccess [closed]
- How to fix .htaccess corrupted
- Protect wp-login, but get an internal server error
- Local wordpress install only shows home page, all other pages Not Found
- Redirect wrong links WordPress
- Accepting special characters in querystring
- Cannot access subdirectory subpages
- WordPress constantly running out of memory
- How can I create a smarter .htaccess file that will add a directory?
- WP Codex answer incomplete? Put WP in subdirectory. .htaccess change required
- .htaccess found in every folder
- All navigation links on website redirect to same page
- WordPress is removing trailing slash
- How do I properly redirect requests to WordPress subdirectory?
- Htaccess file reset automatically how to fix this issue
- Clone WordPress for testing on localhost (with Fiddler)
- Force a 403 response to xml file in WordPress
- Redirect files in uploads directory if WordPress user not logged in
- Redirect wordpress site to www from non www on wordpress server
- Update htaccess in several WP sites at once
- Pretty Url not working on the server
- How to use slug with subdomain?
- Leverage browser caching
- Reversing domain ‘sharding’ with htaccess
- WordPress URL not working?
- How to direct users to a subcatalog
- WordPress Intercepting Requests To A File In Public HTML
- How to block wordpress admin by htaccess
- Htaccess remove dates from root site but not from subdomain
- .htaccess home configuration
- Installing wordpress on subdirectory 2 levels down
- htaccess conflict between WordPress and password protected subdirectory
- Cannot Override WordPress 404 for a Sub-Directory
- adding a rewrite rule in wordpress functions file
- Multisite permalinks for subfolder wordpress installation
- Missing visual editor after placing a redirect rule into the .htaccess file
- Using subdomain as primary domain
- Redirect not working
- Permanently Redirect WordPress Subfolder Blog to Subdomain on Another Server
- WordPress site not redirecting properly
- Add-on domain works in WordPress but links still lead to subdomain
- In a subdomain network, what .htaccess settings can I use to have WP ignore requests to one subdomain?
- htaccess rule to ignore specific subdomain [closed]
- .htaccess for Subdomain and Subfolder w/SSL
- Why my wp site always redirecting to the old website path..?
- Hiding wp-config.php via .htaccess on an install installed in another directory?
- .htaccess seems to be required but I can not find it