WPSEO_Utils::extend_kses_post_with_a11y()public staticYoast 1.0

Extends the allowed post tags with accessibility-related attributes.

Метод класса: WPSEO_Utils{}

Хуков нет.

Возвращает

Массив. The allowed tags including post tags, input tags and select tags.

Использование

$result = WPSEO_Utils::extend_kses_post_with_a11y( $allowed_post_tags );
$allowed_post_tags(массив) (обязательный)
The allowed post tags.

Код WPSEO_Utils::extend_kses_post_with_a11y() Yoast 22.4

public static function extend_kses_post_with_a11y( $allowed_post_tags ) {
	static $a11y_tags;

	if ( isset( $a11y_tags ) === false ) {
		$a11y_tags = [
			'button'   => [
				'aria-expanded' => true,
				'aria-controls' => true,
			],
			'div'      => [
				'tabindex' => true,
			],
			// Below are attributes that are needed for backwards compatibility (WP < 5.1).
			'span'     => [
				'aria-hidden' => true,
			],
			'input'    => [
				'aria-describedby' => true,
			],
			'select'   => [
				'aria-describedby' => true,
			],
			'textarea' => [
				'aria-describedby' => true,
			],
		];

		// Add the global allowed attributes to each html element.
		$a11y_tags = array_map( '_wp_add_global_attributes', $a11y_tags );
	}

	return array_merge_recursive( $allowed_post_tags, $a11y_tags );
}