Below is the code I am using
add_action( 'rest_api_init', 'add_custom_users_api');
function add_custom_users_api(){
register_rest_route( 'testing', '/users', array(
'methods' => 'GET',
'callback' => 'get_custom_users_data',
));
}
function get_custom_users_data($data){
//get users by market
$result = "Testing this";
return $result;
}
Below is the response I am getting
答案 0 :(得分:1)
试试这个
add_action( 'rest_api_init', 'add_custom_users_api');
function add_custom_users_api(){
register_rest_route( 'testing', '/users', array(
'methods' => 'GET',
'callback' => 'get_custom_users_data',
));
}
function get_custom_users_data($data){
//get users by market
$result = "Testing this";
return $result;
}