我的插件中有以下代码,在开发过程中一直运行良好(在中调用rest_api_init
).
// ?rest_route=bridge/v1/test-data/process/bbe_examples
register_rest_route(
\'bridge/v1\', \'/(?P<participant>[a-zA-Z0-9-_]+)/process/(?P<section>[a-zA-Z0-9-_]+)\', [
\'methods\' => \'GET\',
\'callback\' => [ $this->api, \'process\' ],
]
);
<My URL>/index.php?rest_route=/bridge/v1/test-data/process/bbe_sortables&replace&_wpnonce=<thenonce>
无论是否启用,都可以正常工作。<My URL>/wp-json/bridge/v1/test-data/process/bbe_sortables&replace&_wpnonce=<thenonce>
退货404 rest_no_route
调用时。
这些都是当前由一些生成的按钮调用的,这些按钮是使用rest_url( "bridge/v1/test-data/process/" )
(thesection
在显示期间附加到字符串)。
我不完全确定这里出了什么问题。我假设我必须生成完整的URLrest_url()
, 但当通过浏览器或API系统直接调用时,响应是相同的。