WordPress at a glance

balanceTags() WP 1.0

Balances tags if forced to, or if the 'use_balanceTags' option is set to true.

Works based on: force_balance_tags()

No Hooks.


String. Balanced text


balanceTags( $text, $force )  // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid;
$text(string) (required)
Text to be balanced
If true, forces balancing, ignoring the value of the option.
Default: false


Since 0.71 Introduced.

Code of balanceTags() WP 5.7.2

function balanceTags( $text, $force = false ) {  // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
	if ( $force || (int) get_option( 'use_balanceTags' ) === 1 ) {
		return force_balance_tags( $text );
	} else {
		return $text;

From tag: Site security (safety)

More from category: Formatting

No comments
    Log In