Yoast\WP\SEO\Helpers

String_Helper::strip_shortcode()publicYoast 1.0

First strip out registered and enclosing shortcodes using native WordPress strip_shortcodes function. Then strip out the shortcodes with a filthy regex, because people don't properly register their shortcodes.

Метод класса: String_Helper{}

Хуков нет.

Возвращает

Строку. String without shortcodes.

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

$String_Helper = new String_Helper();
$String_Helper->strip_shortcode( $text );
$text(строка) (обязательный)
Input string that might contain shortcodes.

Код String_Helper::strip_shortcode() Yoast 22.4

public function strip_shortcode( $text ) {
	return \preg_replace( '`\[[^\]]+\]`s', '', \strip_shortcodes( $text ) );
}