WP_REST_Global_Styles_Revisions_Controller::get_revision( int $id ): WP_Post|WP_Error

In this article

Gets the global styles revision, if the ID is valid.

Parameters

$idintrequired
Supplied ID.

Return

WP_Post|WP_Error Revision post object if ID is valid, WP_Error otherwise.

Source

}

$fields     = $this->get_fields_for_response( $request );
$data       = array();
$theme_json = null;

if ( ! empty( $global_styles_config['styles'] ) || ! empty( $global_styles_config['settings'] ) ) {
	$theme_json           = new WP_Theme_JSON( $global_styles_config, 'custom' );
	$global_styles_config = $theme_json->get_raw_data();
	if ( rest_is_field_included( 'settings', $fields ) ) {
		$data['settings'] = ! empty( $global_styles_config['settings'] ) ? $global_styles_config['settings'] : new stdClass();
	}
	if ( rest_is_field_included( 'styles', $fields ) ) {
		$data['styles'] = ! empty( $global_styles_config['styles'] ) ? $global_styles_config['styles'] : new stdClass();
	}
}

if ( rest_is_field_included( 'author', $fields ) ) {

Changelog

VersionDescription
6.5.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.