[ad_1]
Guys I’m trying to enable WordPress rest api endpoint and works when I logged in BUT for public appears:
{
“code”: “rest_not_logged_in”,
“message”: “You are not currently logged in.”,
“data”: {
“status”: 401
}
}
some of you knows how can I make public this endpoint? is just a GET OF DATA
The way I got it is:
public function register_people_rest_route() {
register_rest_route(
‘wp/v2’,
‘/people’,
array(
‘methods’ => ‘GET’,
‘callback’ => array( $this, ‘get_people_data’ ),
)
);
}

You’re probably missing
`add_action( ‘rest_api_init’, ‘register_people_rest_route’)`