apply_filters( 'update_custom_css_data', array $data, array $args )
- Since
- 4.7.0
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 );
Compatibility
- WordPress
- since 4.7.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$dataarray- { Custom CSS data.
@type string $css CSS stored inpost_content.
@type string $preprocessed Pre-processed CSS stored inpost_content_filtered.
Normally empty string.
}$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.
@type string $css The original CSS passed in to be updated.
@type string $preprocessed The original preprocessed CSS passed in to be updated.
@type string $stylesheet The stylesheet (theme) being updated.
}$cssstringThe original CSS passed in to be updated.$preprocessedstringThe original preprocessed CSS passed in to be updated.$stylesheetstringThe stylesheet (theme) being updated.
Where this hook fires · 1
wp-includes/theme.php:2134wp_update_custom_css_post()
Source code
* * @type string $css The original CSS passed in to be updated. * @type string $preprocessed The original preprocessed CSS passed in to be updated. * @type string $stylesheet The stylesheet (theme) being updated. * } */ $data = apply_filters( 'update_custom_css_data', $data, array_merge( $args, compact( 'css' ) ) ); $post_data = array( 'post_title' => $args['stylesheet'], 'post_name' => sanitize_title( $args['stylesheet'] ), 'post_type' => 'custom_css', 'post_status' => 'publish',Changelog
Introduced in 4.7.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.9.7 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.