WP_HTML_Tag_Processor::matches(): bool

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only by core. It is listed here for completeness.

Checks whether a given tag and its attributes match the search criteria.

Return

bool Whether the given tag and its attribute match the search criteria.

Source

private function matches(): bool {
	if ( $this->is_closing_tag && ! $this->stop_on_tag_closers ) {
		return false;
	}

	// Does the tag name match the requested tag name in a case-insensitive manner?
	if (
		isset( $this->sought_tag_name ) &&
		(
			strlen( $this->sought_tag_name ) !== $this->tag_name_length ||
			0 !== substr_compare( $this->html, $this->sought_tag_name, $this->tag_name_starts_at, $this->tag_name_length, true )
		)
	) {
		return false;
	}

	if ( null !== $this->sought_class_name && ! $this->has_class( $this->sought_class_name ) ) {
		return false;
	}

	return true;
}

Changelog

VersionDescription
6.2.0Introduced.

User Contributed Notes

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