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. Built from https://develop.svn.wordpress.org/trunk@52017 git-svn-id: http://core.svn.wordpress.org/trunk@51609 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
04a853195b
commit
fa473014dc
|
@ -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(
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.9-alpha-52016';
|
||||
$wp_version = '5.9-alpha-52017';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue