I have the following code in my plugin, which during development has been working perfectly fine (called within 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>
Works fine, regardless of whether they're enabled.
<My URL>/wp-json/bridge/v1/test-data/process/bbe_sortables&replace&_wpnonce=<thenonce>
returns 404 rest_no_route
when called.
These are both currently called by some generated buttons, which are generated using rest_url( "bridge/v1/test-data/process/" )
(the section
is appended to the string during display).
I'm not entirely sure what's going wrong here. I assumed I had to generate the full URL with rest_url()
, but when directly called via the browser or API system the response is the same.
bbe_sortables&replace
in the pretty URL. If you change it tobbe_sortables?replace
, that should work.test-data/process/page/2
to make it more clearer. Some of my older API practices were coming in.