Make WordPress Core


Ignore:
Timestamp:
11/05/2021 02:29:32 AM (5 years ago)
Author:
TimothyBlynJacobs
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php

    r51786 r52017  
    1616 */
    1717class WP_REST_Themes_Controller extends WP_REST_Controller {
     18
     19        const PATTERN = '[^.\/]+(?:\/[^.\/]+)?';
    1820
    1921        /**
     
    5153                register_rest_route(
    5254                        $this->namespace,
    53                         '/' . $this->rest_base . '/(?P<stylesheet>[\w-]+)',
     55                        sprintf( '/%s/(?P<stylesheet>%s)', $this->rest_base, self::PATTERN ),
    5456                        array(
    5557                                'args'   => array(
Note: See TracChangeset for help on using the changeset viewer.