plugins - No route was found matching the URL and request method

I just created a test restapi function but it returns 404, please tell me what m doing wrong?function draftusr( WP_REST_

I just created a test restapi function but it returns 404, please tell me what m doing wrong?

function draftusr( WP_REST_Request $request ) {

        $usr= 20;

        return $usr;
    }
    add_action( 'rest_api_init', function () {

  register_rest_route( 'draftusr/v2', '/draftusr', array(
        'methods' => array('GET','POST'),
        'callback' => 'draftusr',
    ) );

});

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742405475a4437757.html

相关推荐

  • plugins - No route was found matching the URL and request method

    I just created a test restapi function but it returns 404, please tell me what m doing wrong?function draftusr( WP_REST_

    9小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信