This is my Custom End point but its says "No route was found matching the URL and request method" i added in the theme folder function.php file. when i changed the method 'POST' to 'GET' it works fine for get method .htaccess file is ok any other plugin like securty or other rest api plugin not installed only "WP REST API plugin" is activated
add_action( 'rest_api_init', 'myfunction' );
function myfunction() {
register_rest_route( 'app', '/addmeta', array(
'methods' => 'POST',
'callback' => 'vendor_serve_route'
) );
}
function vendor_serve_route(WP_REST_Request $request_data ) {
// Fetching values from API
$data = $request_data->get_params();`enter code here`
$user_data = array( 'user_login' => $data['first_name'],
'user_email' => $data['user_email'],
'nickname' => $data['user_name'],
'first_name' => $data['first_name'],
'last_name' => $data['last_name'],
);
return ['Data' => $user_data];
}
POST
method? You have to change it in the endpoint and wherever you're making the request. – gd_silva