wp_default_editor()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
wp_default_editor(): string
Описание
Определяет, какой из редакторов показать пользователю в качестве текущего. Настройка 'html' соответствует вкладке редактора «Код».
Оригинал (английский)
Works out which of the editors to display as the current editor for a user. The ‘html’ setting is for the “Code” editor tab.
Возвращаемое значение
string
Исходный код
wp-includes/general-template.php:3954
function wp_default_editor() {
$r = user_can_richedit() ? 'tinymce' : 'html'; // Defaults.
if ( wp_get_current_user() ) { // Look for cookie.
$ed = get_user_setting( 'editor', 'tinymce' );
$r = ( in_array( $ed, array( 'tinymce', 'html', 'test' ), true ) ) ? $ed : $r;
}
/**
* Filters which editor should be displayed by default.
*
* @since 2.5.0
*
* @param string $r Which editor should be displayed by default. Either 'tinymce', 'html', or 'test'.
*/
return apply_filters( 'wp_default_editor', $r );
}
История изменений
| Версия | Описание |
|---|---|
| 2.5.0 | Introduced. |

