safe_style_css
Filters the list of allowed CSS attributes.
Usage
add_filter( 'safe_style_css', 'wp_kama_safe_style_css_filter' );
/**
* Function for `safe_style_css` filter-hook.
*
* @param string[] $attr Array of allowed CSS attributes.
*
* @return string[]
*/
function wp_kama_safe_style_css_filter( $attr ){
// filter...
return $attr;
}
- $attr(string[])
- Array of allowed CSS attributes.
Changelog
| Since 2.8.1 | Introduced. |
| Since 7.1.0 | Added support for SVG presentation attributes. |
Where the hook is called
safe_style_css
wp-includes/kses.php 2669-2892
$allowed_attr = apply_filters( 'safe_style_css', array( 'background', 'background-color', 'background-image', 'background-position', 'background-repeat', 'background-size', 'background-attachment', 'background-blend-mode', 'border', 'border-radius', 'border-width', 'border-color', 'border-style', 'border-right', 'border-right-color', 'border-right-style', 'border-right-width', 'border-bottom', 'border-bottom-color', 'border-bottom-left-radius', 'border-bottom-right-radius', 'border-bottom-style', 'border-bottom-width', 'border-bottom-right-radius', 'border-bottom-left-radius', 'border-left', 'border-left-color', 'border-left-style', 'border-left-width', 'border-top', 'border-top-color', 'border-top-left-radius', 'border-top-right-radius', 'border-top-style', 'border-top-width', 'border-top-left-radius', 'border-top-right-radius', 'border-spacing', 'border-collapse', 'caption-side', 'columns', 'column-count', 'column-fill', 'column-gap', 'column-rule', 'column-span', 'column-width', 'display', 'color', 'filter', 'font', 'font-family', 'font-size', 'font-style', 'font-variant', 'font-weight', 'letter-spacing', 'line-height', 'text-align', 'text-decoration', 'text-indent', 'text-transform', 'white-space', 'height', 'min-height', 'max-height', 'width', 'min-width', 'max-width', 'margin', 'margin-right', 'margin-bottom', 'margin-left', 'margin-top', 'margin-block-start', 'margin-block-end', 'margin-inline-start', 'margin-inline-end', 'padding', 'padding-right', 'padding-bottom', 'padding-left', 'padding-top', 'padding-block-start', 'padding-block-end', 'padding-inline-start', 'padding-inline-end', 'flex', 'flex-basis', 'flex-direction', 'flex-flow', 'flex-grow', 'flex-shrink', 'flex-wrap', 'gap', 'column-gap', 'row-gap', 'grid-template-columns', 'grid-auto-columns', 'grid-column-start', 'grid-column-end', 'grid-column', 'grid-column-gap', 'grid-template-rows', 'grid-auto-rows', 'grid-row-start', 'grid-row-end', 'grid-row', 'grid-row-gap', 'grid-gap', 'justify-content', 'justify-items', 'justify-self', 'align-content', 'align-items', 'align-self', 'clear', 'cursor', 'direction', 'float', 'list-style-type', 'object-fit', 'object-position', 'opacity', 'overflow', 'vertical-align', 'writing-mode', 'position', 'top', 'right', 'bottom', 'left', 'z-index', 'box-shadow', 'aspect-ratio', 'container-type', 'fill', 'fill-opacity', 'fill-rule', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'color-interpolation', 'color-interpolation-filters', 'paint-order', 'stop-color', 'stop-opacity', 'flood-color', 'flood-opacity', 'lighting-color', 'marker', 'marker-end', 'marker-mid', 'marker-start', 'clip-path', 'clip-rule', 'mask', 'mask-type', 'cx', 'cy', 'r', 'rx', 'ry', 'x', 'y', 'd', 'alignment-baseline', 'baseline-shift', 'dominant-baseline', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'text-anchor', 'unicode-bidi', 'word-spacing', 'font-size-adjust', 'font-stretch', 'color-rendering', 'image-rendering', 'shape-rendering', 'text-rendering', 'vector-effect', 'transform', 'transform-origin', 'pointer-events', 'visibility', // Custom CSS properties. '--*', ) );