wppaste
WordPress

apply_filters( 'safecss_filter_attr_allow_css', bool $allow_css, string $css_test_string )

Since
5.5.0
Filters the check for unsafe CSS in safecss_filter_attr.

Description

Enables developers to determine whether a section of CSS should be allowed or discarded.
By default, the value will be false if the part contains \ ( & } = or comments.
Return true to allow the CSS part to be included in the output.

Compatibility

WordPress
since 5.5.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

$allow_cssbool
Whether the CSS in the test string is considered safe.
$css_test_stringstring
The CSS string to test.

Where this hook fires · 1

  • wp-includes/kses.php:3058safecss_filter_attr()

Source code

			 *			 * @since 5.5.0			 *			 * @param bool   $allow_css       Whether the CSS in the test string is considered safe.			 * @param string $css_test_string The CSS string to test.			 */			$allow_css = apply_filters( 'safecss_filter_attr_allow_css', $allow_css, $css_test_string ); 			// Only add the CSS part if it passes the regex check.			if ( $allow_css ) {				if ( '' !== $css ) {					$css .= ';';				}

Changelog

Introduced in 5.5.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 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.