Balances tags if forced to, or if the ‘use_balanceTags’ option is set to true.
$textstringrequired
$forcebooloptional
Default:false
The option ‘use_balanceTags’ is used for whether the tags will be balanced. Either the $force parameter or ‘use_balanceTags’ option need to be true before the tags will be balanced.
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;
}
}
| Version | Description |
|---|---|
| 0.71 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/balancetags