I'm trying to add an endpoint with the following:
register_rest_route('namespace/v1','custom-search/(?P<search>[a-zA-Z\s]+)',
array(
'methods' => 'GET',
'callback' => 'gm_custom_search_callback'
)
);
It registers the route, but won't recognise when I add a space character i.e. %20 or pass a string with a " " in, I can't see anywhere that would suggest how this should be achieved, am I missing something?
-
or something more unique in the passed search parameter - just make sure the placeholder is allowed in the endpoint regex - then replace these before passing the value to the callback method.