WP_CLI\Utils
strip_tags()
Failsafe use of the WordPress wp_strip_all_tags() function.
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() strip tags code 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 ); }