WP_CLI\Utils

strip_tags()WP-CLI 1.0

Failsafe use of the WordPress wp_strip_all_tags() function.

Automatically falls back to strip_tags() function if the WP function is not available.

Хуков нет.

Возвращает

Строку. String devoid of tags.

Использование

strip_tags( $string );
$string(строка) (обязательный)
String to strip the tags from.

Код strip_tags() WP-CLI 2.8.0-alpha

function strip_tags( $string ) {
	if ( function_exists( 'wp_strip_all_tags' ) ) {
		return \wp_strip_all_tags( $string );
	}

	$string = preg_replace(
		'@<(script|style)[^>]*?>.*?</\\1>@si',
		'',
		$string
	);

	// phpcs:ignore WordPress.WP.AlternativeFunctions.strip_tags_strip_tags -- Fallback.
	$string = \strip_tags( $string );

	return trim( $string );
}