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.

Return

String. Balanced text

Usage

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

Changelog

Since 0.71 Introduced.

Code of balanceTags: wp-includes/formatting.php WP 5.4.2

<?php
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;
	}
}

Related Functions

From tag: Site security (safety)

More from category: Formatting

No comments
        Log In . Register