admin管理员组文章数量:1130349
I want to get user by email address. Getting issue with custom api endpoint route.
function getUserByEmail( $data ) {
$user = get_user_by( 'email', $data['email'] );
if ( empty( $user ) ) {
return null;
}
return $user;
}
add_action( 'rest_api_init', function () {
register_rest_route( 'myplugin/v1', '/updateRole/(?P<email>\d+)', array(
'methods' => 'GET',
'callback' => 'getUserByEmail',
) );
} );
Error : {"code":"rest_no_route","message":"No route was found matching the URL and request method","data":{"status":404}}
I want to get user by email address. Getting issue with custom api endpoint route.
function getUserByEmail( $data ) {
$user = get_user_by( 'email', $data['email'] );
if ( empty( $user ) ) {
return null;
}
return $user;
}
add_action( 'rest_api_init', function () {
register_rest_route( 'myplugin/v1', '/updateRole/(?P<email>\d+)', array(
'methods' => 'GET',
'callback' => 'getUserByEmail',
) );
} );
Error : {"code":"rest_no_route","message":"No route was found matching the URL and request method","data":{"status":404}}
本文标签: rest apiWordpress Update Role using API Cross site
版权声明:本文标题:rest api - Wordpress Update Role using API Cross site 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749062664a2310340.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论