On this page
apply_filters( 'update_custom_css_data', array $data, array $args )
Filters the css (post_content) and preprocessed (post_content_filtered) args for a custom_css post being updated.
Description
This filter can be used by plugin that offer CSS pre-processors, to store the original pre-processed CSS in post_content_filtered and then store processed CSS in post_content.
When used in this way, the post_content_filtered should be supplied as the setting value instead of post_content via a the customize_value_custom_css filter, for example:
add_filter( 'customize_value_custom_css', function( $value, $setting ) {
$post = wp_get_custom_css_post( $setting->stylesheet );
if ( $post && ! empty( $post->post_content_filtered ) ) {
$css = $post->post_content_filtered;
}
return $css;
}, 10, 2 );
Parameters
$dataarray-
Custom CSS data.
cssstringCSS stored inpost_content.preprocessedstringPre-processed CSS stored inpost_content_filtered.
Normally empty string.
$argsarray-
The args passed into
wp_update_custom_css_post()merged with defaults.
cssstringThe original CSS passed in to be updated.preprocessedstringThe original preprocessed CSS passed in to be updated.stylesheetstringThe stylesheet (theme) being updated.
Source
File: wp-includes/theme.php. View all references
$data = apply_filters( 'update_custom_css_data', $data, array_merge( $args, compact( 'css' ) ) );
Related
Used By
| Used By | Description |
|---|---|
| wp_update_custom_css_post() wp-includes/theme.php | Updates the |
Changelog
| Version | Description |
|---|---|
| 4.7.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/update_custom_css_data