WP_HTML_Tag_Processor::remove_class()publicWP 6.2.0

Removes a class name from the currently matched tag.

Method of the class: WP_HTML_Tag_Processor{}

No Hooks.

Return

true|false. Whether the class was set to be removed.

Usage

$WP_HTML_Tag_Processor = new WP_HTML_Tag_Processor();
$WP_HTML_Tag_Processor->remove_class( $class_name );
$class_name(string) (required)
The class name to remove.

Changelog

Since 6.2.0 Introduced.

WP_HTML_Tag_Processor::remove_class() code WP 6.6.2

public function remove_class( $class_name ) {
	if (
		self::STATE_MATCHED_TAG !== $this->parser_state ||
		$this->is_closing_tag
	) {
		return false;
	}

	if ( null !== $this->tag_name_starts_at ) {
		$this->classname_updates[ $class_name ] = self::REMOVE_CLASS;
	}

	return true;
}