balancetags

函数


balancetags ( $text, $force = false )
参数
  • (string)
    $text
    Text to be balanced
    Required:
  • (bool)
    $force
    If true, forces balancing, ignoring the value of the option. Default false.
    Required:
    Default: false
返回值
  • (string) Balanced text
定义位置
  • wp-includes/formatting.php
    , line 2514
引入
0.71
弃用

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

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