it works thanks 🙂 . one more thing how to secure all wp api i have added this code to function.php ->
add_filter( ‘rest_api_init’, ‘rest_only_for_authorized_users’, 99 );
function rest_only_for_authorized_users($wp_rest_server){
if ( !is_user_logged_in() ) {
wp_die(‘sorry you are not allowed to access this data’,’cheatin eh?’,403);
}
}
it works fine with browser but with postman i still can access the api without auth. any help?