WP_CLI\Utils

strip_tags()WP-CLI 1.0

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

No Hooks.

Return

String. String devoid of tags.

Usage

strip_tags( $string );
$string(string) (required)
String to strip the tags from.

strip_tags() code WP-CLI 2.7.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 );
}