WP_REST_Global_Styles_Revisions_Controller::get_decoded_global_styles_json()
Returns decoded JSON from post content string, or a 404 if not found.
Метод класса: WP_REST_Global_Styles_Revisions_Controller{}
Хуков нет.
Возвращает
Array|WP_Error
.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_decoded_global_styles_json( $raw_json );
- $raw_json(строка) (обязательный)
- Encoded JSON from global styles custom post content.
Список изменений
С версии 6.3.0 | Введена. |
Код WP_REST_Global_Styles_Revisions_Controller::get_decoded_global_styles_json() WP REST Global Styles Revisions Controller::get decoded global styles json WP 6.7.1
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 ) ); }