format_for_editor()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
format_for_editor( string $text, string $default_editor = null ): string
Описание
Русский перевод этого описания пока проверяется. Показан оригинал.
Generally the browsers treat everything inside a textarea as text, but it is still a good idea to HTML entity encode <, > and & in the content.
The filter ‘format_for_editor’ is applied here. If $text is empty the filter will be applied to an empty string.
Параметры
$text
string
обязательный
$default_editor
string
необязательный
= null
Возвращаемое значение
string
Исходный код
wp-includes/formatting.php:4394
function format_for_editor( $text, $default_editor = null ) {
if ( $text ) {
$text = htmlspecialchars( $text, ENT_NOQUOTES, get_option( 'blog_charset' ) );
}
/**
* Filters the text after it is formatted for the editor.
*
* @since 4.3.0
*
* @param string $text The formatted text.
* @param string $default_editor The default editor for the current user.
* It is usually either 'html' or 'tinymce'.
*/
return apply_filters( 'format_for_editor', $text, $default_editor );
}
История изменений
| Версия | Описание |
|---|---|
| 4.3.0 | Introduced. |

