WP_REST_Global_Styles_Revisions_Controller::get_decoded_global_styles_json( string $raw_json ): Array|WP_Error
Returns decoded JSON from post content string, or a 404 if not found.
Parameters
-
$raw_json
string Required -
Encoded JSON from global styles custom post content.
Return
Array|WP_Error
Source
File: wp-includes/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php
.
View all references
protected function get_decoded_global_styles_json( $raw_json ) {
$decoded_json = json_decode( $raw_json, true );
if ( is_array( $decoded_json ) && isset( $decoded_json['isGlobalStylesUserThemeJSON'] ) && true === $decoded_json['isGlobalStylesUserThemeJSON'] ) {
return $decoded_json;
}
return new WP_Error(
'rest_global_styles_not_found',
__( 'Cannot find user global styles revisions.' ),
array( 'status' => 404 )
);
}
Changelog
Version | Description |
---|---|
6.3.0 | Introduced. |