wp-api-plugins-themes-endpoints
wp-api-plugins-themes-endpoints copied to clipboard
Support theme slugs with `/` in the slug
One thing to be aware of is that themes can be installed in subdirectories of themes, for instance wp-content/themes/free/my-awesome-theme. As such, we'll need to somehow support themes where a / could be in the slug.
Wouldn't this do the trick:
register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<slug>[\w-|\/]+)
hmm I don't know if / is a valid slug character. While this is possible in wordpress, a slug almost by definition should not have a / in it - maybe we'd have to transform it in the response and somehow on input too, but keeping a slash in the url is going to be mightily confusing.