WP_HTML_Processor::is_void( string $tag_name ): bool

Returns whether a given element is an HTML Void Element

Description

area, base, br, col, embed, hr, img, input, link, meta, source, track, wbr

See also

Parameters

$tag_namestringrequired
Name of HTML tag to check.

Return

bool Whether the given tag is an HTML Void Element.

Source

public static function is_void( $tag_name ) {
	$tag_name = strtoupper( $tag_name );

	return (
		'AREA' === $tag_name ||
		'BASE' === $tag_name ||
		'BR' === $tag_name ||
		'COL' === $tag_name ||
		'EMBED' === $tag_name ||
		'HR' === $tag_name ||
		'IMG' === $tag_name ||
		'INPUT' === $tag_name ||
		'LINK' === $tag_name ||
		'META' === $tag_name ||
		'SOURCE' === $tag_name ||
		'TRACK' === $tag_name ||
		'WBR' === $tag_name
	);
}

Changelog

VersionDescription
6.4.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.