_wp_kses_restricts_attribute_values()
Determines whether KSES restricts the value of any attribute of an element.
An attribute rule other than required and valueless restricts the value itself, for example values or value_callback.
Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.
No Hooks.
Returns
bool. Whether KSES restricts the value of any attribute of the element.
Usage
_wp_kses_restricts_attribute_values( $allowed_attributes ): bool;
- $allowed_attributes(array|true|false) (required)
- The attributes KSES allows on the element.
Changelog
| Since 7.1.4 | Introduced. |
_wp_kses_restricts_attribute_values() wp kses restricts attribute values code WP 7.1.4
function _wp_kses_restricts_attribute_values( $allowed_attributes ): bool {
if ( ! is_array( $allowed_attributes ) ) {
return false;
}
foreach ( $allowed_attributes as $attribute_rules ) {
if ( ! is_array( $attribute_rules ) ) {
continue;
}
foreach ( array_keys( $attribute_rules ) as $rule ) {
if ( ! in_array( strtolower( (string) $rule ), array( 'required', 'valueless' ), true ) ) {
return true;
}
}
}
return false;
}