A WordPress-centric search engine for devs and theme authors



balancetags ›

Since0.71
Deprecatedn/a
balancetags ( $text, $force = false )
Parameters: (2)
  • (string) $text Text to be balanced
    Required: Yes
  • (bool) $force If true, forces balancing, ignoring the value of the option. Default false.
    Required: No
    Default: false
Returns:
  • (string) Balanced text
Defined at:
Codex:

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



Source

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