admin管理员组

文章数量:1336304

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',
    ) );

});

本文标签: pluginsNo route was found matching the URL and request method