wp_filter_global_styles_post()
Sanitizes global styles user content removing unsafe rules.
Хуков нет.
Возвращает
Строку. Filtered post content with unsafe rules removed.
Использование
wp_filter_global_styles_post( $data );
- $data(строка) (обязательный)
- Post content to filter.
Список изменений
| С версии 5.9.0 | Введена. |
Код wp_filter_global_styles_post() wp filter global styles post WP 6.9.1
function wp_filter_global_styles_post( $data ) {
$decoded_data = json_decode( wp_unslash( $data ), true );
$json_decoding_error = json_last_error();
if (
JSON_ERROR_NONE === $json_decoding_error &&
is_array( $decoded_data ) &&
isset( $decoded_data['isGlobalStylesUserThemeJSON'] ) &&
$decoded_data['isGlobalStylesUserThemeJSON']
) {
unset( $decoded_data['isGlobalStylesUserThemeJSON'] );
$data_to_encode = WP_Theme_JSON::remove_insecure_properties( $decoded_data, 'custom' );
$data_to_encode['isGlobalStylesUserThemeJSON'] = true;
return wp_slash( wp_json_encode( $data_to_encode ) );
}
return $data;
}