update_custom_css_data
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
apply_filters( 'update_custom_css_data', array $data, array $args )
Описание
Этот фильтр может использоваться плагинами, предоставляющими CSS-препроцессоры, чтобы сохранять исходный необработанный CSS в post_content_filtered, а затем сохранять обработанный CSS в post_content.
При таком использовании post_content_filtered следует передавать как значение настройки вместо post_content через фильтр customize_value_custom_css, например:
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 );
Оригинал (английский)
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 );
Фильтруемое значение
Параметры
$data
array
обязательный
$args
array
обязательный
Исходный код
wp-includes/theme.php:2124
$data = apply_filters( 'update_custom_css_data', $data, array_merge( $args, compact( 'css' ) ) );
История изменений
| Версия | Описание |
|---|---|
| 4.7.0 | Introduced. |

