# strip_shortcodes()

URL: https://chugunov.pro/api-wordpress/functions/strip_shortcodes/
Проверено на WordPress 6.9, обновлено 06.08.2026.
Источник: независимый русскоязычный справочник chugunov.pro. Не является официальной документацией WordPress.

Тип: функция.
Появился в версии: 2.5.0.

## Сигнатура

```php
strip_shortcodes( string $content ): string
```

## Описание

Удаляет все теги шорткодов из переданного содержимого.

## Параметры

- `$content` `string` — обязательный. Содержимое, из которого удаляются теги шорткодов.

## Возвращаемое значение

`string`

## Исходный код

Файл: `wp-includes/shortcodes.php:706`

```php
function strip_shortcodes( $content ) {
	global $shortcode_tags;

	if ( ! str_contains( $content, '[' ) ) {
		return $content;
	}

	if ( empty( $shortcode_tags ) || ! is_array( $shortcode_tags ) ) {
		return $content;
	}

	// Find all registered tag names in $content.
	preg_match_all( '@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches );

	$tags_to_remove = array_keys( $shortcode_tags );

	/**
	 * Filters the list of shortcode tags to remove from the content.
	 *
	 * @since 4.7.0
	 *
	 * @param array  $tags_to_remove Array of shortcode tags to remove.
	 * @param string $content        Content shortcodes are being removed from.
	 */
	$tags_to_remove = apply_filters( 'strip_shortcodes_tagnames', $tags_to_remove, $content );

	$tagnames = array_intersect( $tags_to_remove, $matches[1] );

	if ( empty( $tagnames ) ) {
		return $content;
	}

	$content = do_shortcodes_in_html_tags( $content, true, $tagnames );

	$pattern = get_shortcode_regex( $tagnames );
	$content = preg_replace_callback( "/$pattern/", 'strip_shortcode_tag', $content );

	// Always restore square braces so we don't break things like <!--[if IE ]>.
	$content = unescape_invalid_shortcodes( $content );

	return $content;
}
```

## История изменений

- 2.5.0 — Introduced.

## Связанные

Использует: [`do_shortcodes_in_html_tags`](https://chugunov.pro/api-wordpress/functions/do_shortcodes_in_html_tags/), [`unescape_invalid_shortcodes`](https://chugunov.pro/api-wordpress/functions/unescape_invalid_shortcodes/), [`get_shortcode_regex`](https://chugunov.pro/api-wordpress/functions/get_shortcode_regex/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/).
Используется в: [`wp_trim_excerpt`](https://chugunov.pro/api-wordpress/functions/wp_trim_excerpt/).

Оригинал в официальной документации: https://developer.wordpress.org/reference/functions/strip_shortcodes/
