wpseek.com
WordPress开发者和主题制作者的搜索引擎
wp_strip_custom_css_from_style_array is private and should not be used in themes or plugins directly.
wp_strip_custom_css_from_style_array › WordPress Function
Since7.2.0
已弃用n/a
› wp_strip_custom_css_from_style_array ( $style )
| 访问: |
|
| 参数: |
|
| 返回: |
|
| 定义在: |
|
| 文档: |
Removes custom CSS from a style attribute and any nested style states.
源码
function wp_strip_custom_css_from_style_array( $style ) {
if ( ! is_array( $style ) ) {
return $style;
}
unset( $style['css'] );
foreach ( $style as $key => $value ) {
if ( is_string( $key ) && is_array( $value ) && ( str_starts_with( $key, ':' ) || str_starts_with( $key, '@' ) ) ) {
$nested_style = wp_strip_custom_css_from_style_array( $value );
if ( empty( $nested_style ) ) {
unset( $style[ $key ] );
} else {
$style[ $key ] = $nested_style;
}
}
}
return $style;
}