首先,您应该重新提交permalink,以便在wordpress中启用rest api。您的rest api url是:http://your-site.com/wp-json/
您可以使用以下代码注册新的端点:
add_action( \'rest_api_init\', function () {
register_rest_route( \'myplugin/v1\', \'/author/(?P<id>\\d+)\', array(
\'methods\' => \'GET\',
\'callback\' => \'my_awesome_func\',
) );
} );