wp_filter_global_styles_post() WordPress Function
This function allows for the modification of global stylesheet data before it is output to the browser. It is called during the "wp_print_styles" action.
wp_filter_global_styles_post( string $data ) #
Sanitizes global styles user content removing unsafe rules.
Parameters
- $data
(string)(Required)Post content to filter.
Return
(string) Filtered post content with unsafe rules removed.
Source
File: wp-includes/kses.php
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 );
$data_to_encode['isGlobalStylesUserThemeJSON'] = true;
return wp_slash( wp_json_encode( $data_to_encode ) );
}
return $data;
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 5.9.0 | Introduced. |