mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-04 14:47:02 +00:00
REST API: Support subdirectory themes in the Themes controller.
This allows for themes that are included inside of a subdirectory, for example `subdir/my-theme`, to be accessed via the single item route of the `/wp/v2/themes` controller. Fixes #54349. git-svn-id: https://develop.svn.wordpress.org/trunk@52017 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
*/
|
||||
class WP_REST_Themes_Controller extends WP_REST_Controller {
|
||||
|
||||
const PATTERN = '[^.\/]+(?:\/[^.\/]+)?';
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@@ -50,7 +52,7 @@ class WP_REST_Themes_Controller extends WP_REST_Controller {
|
||||
|
||||
register_rest_route(
|
||||
$this->namespace,
|
||||
'/' . $this->rest_base . '/(?P<stylesheet>[\w-]+)',
|
||||
sprintf( '/%s/(?P<stylesheet>%s)', $this->rest_base, self::PATTERN ),
|
||||
array(
|
||||
'args' => array(
|
||||
'stylesheet' => array(
|
||||
|
||||
Reference in New Issue
Block a user