# wp_richedit_pre()

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

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

> Устаревший элемент. Помечен устаревшим с версии 4.3.0.

## Сигнатура

```php
wp_richedit_pre( string $text ): string
```

## Описание

Здесь применяется фильтр ‘richedit_pre’. Если $text пуст, фильтр будет применён к пустой строке.
См. alsoformat_for_editor()

## Параметры

- `$text` `string` — обязательный. Текст для форматирования.

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

`string`

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

Файл: `wp-includes/deprecated.php:3586`

```php
function wp_richedit_pre($text) {
	_deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' );

	if ( empty( $text ) ) {
		/**
		 * Filters text returned for the rich text editor.
		 *
		 * This filter is first evaluated, and the value returned, if an empty string
		 * is passed to wp_richedit_pre(). If an empty string is passed, it results
		 * in a break tag and line feed.
		 *
		 * If a non-empty string is passed, the filter is evaluated on the wp_richedit_pre()
		 * return after being formatted.
		 *
		 * @since 2.0.0
		 * @deprecated 4.3.0
		 *
		 * @param string $output Text for the rich text editor.
		 */
		return apply_filters( 'richedit_pre', '' );
	}

	$output = convert_chars($text);
	$output = wpautop($output);
	$output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) );

	/** This filter is documented in wp-includes/deprecated.php */
	return apply_filters( 'richedit_pre', $output );
}
```

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

- 4.3.0 — Deprecated. Use format_for_editor()
- 2.0.0 — Introduced.

## Связанные

Использует: [`convert_chars`](https://chugunov.pro/api-wordpress/functions/convert_chars/), [`wpautop`](https://chugunov.pro/api-wordpress/functions/wpautop/), [`_deprecated_function`](https://chugunov.pro/api-wordpress/functions/_deprecated_function/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/), [`get_option`](https://chugunov.pro/api-wordpress/functions/get_option/).

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