format_for_editor() WP 4.3.0
Formats text for the editor.
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.
Хуки из функции
Возвращает
Строку. The formatted text after filter is applied.
Использование
format_for_editor( $text, $default_editor );
- $text(строка) (обязательный)
- The text to be formatted.
- $default_editor(строка)
- The default editor for the current user. It is usually either 'html' or 'tinymce'.
Заметки
- Смотрите: _WP_Editors::editor()
Список изменений
С версии 4.3.0 | Введена. |
Код format_for_editor() format for editor WP 5.6.2
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 );
}