_wp_add_global_attributes() WP 3.5.0
Helper function to add global attributes to a tag in the allowed HTML list.
Эта функция считается внутренней для использования самим ядром. Не рекомендуется использовать эту функцию в своем коде.
Хуков нет.
Возвращает
Массив
. The array of attributes with global attributes added.
Использование
_wp_add_global_attributes( $value );
- $value(массив) (обязательный)
- An array of attributes.
Список изменений
С версии 3.5.0 | Введена. |
С версии 5.0.0 | Add support for data-* wildcard attributes. |
Код _wp_add_global_attributes() wp add global attributes WP 5.7
function _wp_add_global_attributes( $value ) {
$global_attributes = array(
'aria-describedby' => true,
'aria-details' => true,
'aria-label' => true,
'aria-labelledby' => true,
'aria-hidden' => true,
'class' => true,
'id' => true,
'style' => true,
'title' => true,
'role' => true,
'data-*' => true,
);
if ( true === $value ) {
$value = array();
}
if ( is_array( $value ) ) {
return array_merge( $value, $global_attributes );
}
return $value;
}