函数原型
balanceTags( string $text, bool $force = false ): string
函数描述
Balances tags if forced to, or if the ‘use_balanceTags’ option is set to true.
是否弃用
未弃用
函数参数
-
$text
string
Required - Text to be balanced
-
$force
bool
Optional - If true, forces balancing, ignoring the value of the option.
Default:
false
函数返回值
string Balanced text
函数位置
File: wp-includes/formatting.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;
}
}
源码链接
变更日志
| Version | Description |
|---|---|
| 0.71 | Introduced. |

