WP_Interactivity_API_Directives_Processor::set_content_between_balanced_tags( string $new_content ): 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 in other core functions. It is listed here for completeness.

Sets the content between two balanced tags.

Parameters

$new_contentstringrequired
The string to replace the content between the matching tags.

Return

bool Whether the content was successfully replaced.

Source

public function set_content_between_balanced_tags( string $new_content ): bool {
	$positions = $this->get_after_opener_tag_and_before_closer_tag_positions( true );
	if ( ! $positions ) {
		return false;
	}
	list( $after_opener_tag, $before_closer_tag ) = $positions;

	$this->lexical_updates[] = new WP_HTML_Text_Replacement(
		$after_opener_tag,
		$before_closer_tag - $after_opener_tag,
		esc_html( $new_content )
	);

	return true;
}

Changelog

VersionDescription
6.5.0Introduced.

User Contributed Notes

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