wppaste
WordPress

WP_REST_Global_Styles_Controller

Source
wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php:13
Base Global Styles REST API Controller.

Compatibility

WordPress
core
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Properties · 1

$allow_batcharrayprotected
Whether the controller supports batching.

Methods · 18

Source code

class WP_REST_Global_Styles_Controller extends WP_REST_Posts_Controller {	/**	 * Whether the controller supports batching.	 *	 * @since 6.6.0	 * @var array	 */	protected $allow_batch = array( 'v1' => false ); 	/**	 * Constructor.	 *	 * @since 6.6.0	 *	 * @param string $post_type Post type.	 */	public function __construct( $post_type = 'wp_global_styles' ) {		parent::__construct( $post_type );	} 	/**	 * Registers the controllers routes.	 *	 * @since 5.9.0	 */	public function register_routes() {		register_rest_route(			$this->namespace,			'/' . $this->rest_base . '/themes/(?P<stylesheet>[\/\s%\w\.\(\)\[\]\@_\-]+)/variations',			array(				array(					'methods'             => WP_REST_Server::READABLE,					'callback'            => array( $this, 'get_theme_items' ),					'permission_callback' => array( $this, 'get_theme_items_permissions_check' ),					'args'                => array(						'stylesheet' => array(							'description' => __( 'The theme identifier' ),							'type'        => 'string',						),					),					'allow_batch'         => $this->allow_batch,				),			)		); 		// List themes global styles.		register_rest_route(			$this->namespace,			// The route.			sprintf(				'/%s/themes/(?P<stylesheet>%s)',				$this->rest_base,				/*				 * Matches theme's directory: `/themes/<subdirectory>/<theme>/` or `/themes/<theme>/`.				 * Excludes invalid directory name characters: `/:<>*?"|`.				 */				'[^\/:<>\*\?"\|]+(?:\/[^\/:<>\*\?"\|]+)?'			),			array(				array(					'methods'             => WP_REST_Server::READABLE,					'callback'            => array( $this, 'get_theme_item' ),					'permission_callback' => array( $this, 'get_theme_item_permissions_check' ),					'args'                => array(						'stylesheet' => array(							'description'       => __( 'The theme identifier' ),							'type'              => 'string',							'sanitize_callback' => array( $this, '_sanitize_global_styles_callback' ),						),					),					'allow_batch'         => $this->allow_batch,				),			)		); 		// Lists/updates a single global style variation based on the given id.		register_rest_route(			$this->namespace,			'/' . $this->rest_base . '/(?P<id>[\/\d+]+)',			array(

Changelog

Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.9.7 tag, from src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.