Returns decoded JSON from post content string, or a 404 if not found.
Parameters
$raw_json
stringrequired- Encoded JSON from global styles custom post content.
Source
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. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.