filter_block_core_template_part_attributes()
Sanitizes the value of the Template Part block's tagName attribute.
Хуков нет.
Возвращает
Строку. The sanitized attribute value.
Использование
filter_block_core_template_part_attributes( $attribute_value, $attribute_name, $allowed_html );
- $attribute_value(строка) (обязательный)
- The attribute value to filter.
- $attribute_name(строка) (обязательный)
- The attribute name.
- $allowed_html(array[]|строка) (обязательный)
- An array of allowed HTML elements and attributes, or a context name such as 'post'. See wp_kses_allowed_html() for the list of accepted context names.
Список изменений
| С версии 6.5.5 | Введена. |
Код filter_block_core_template_part_attributes() filter block core template part attributes WP 6.8.3
function filter_block_core_template_part_attributes( $attribute_value, $attribute_name, $allowed_html ) {
if ( empty( $attribute_value ) || 'tagName' !== $attribute_name ) {
return $attribute_value;
}
if ( ! is_array( $allowed_html ) ) {
$allowed_html = wp_kses_allowed_html( $allowed_html );
}
return isset( $allowed_html[ $attribute_value ] ) ? $attribute_value : '';
}