wp_default_editor

The timeline below displays how wordpress function wp_default_editor has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.5

/**
 * Finds out which editor should be displayed by default.
 *
 * Works out which of the editors to display as the current editor for a
 * user. The 'html' setting is for the "Text" editor tab.
 *
 * @since 2.5.0
 *
 * @return string Either 'tinymce', 'html', or 'test'
 */
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);
}

WordPress Version: 6.1

/**
 * Finds out which editor should be displayed by default.
 *
 * Works out which of the two editors to display as the current editor for a
 * user. The 'html' setting is for the "Text" editor tab.
 *
 * @since 2.5.0
 *
 * @return string Either 'tinymce', or 'html', or 'test'
 */
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);
}

WordPress Version: 5.5

/**
 * Find out which editor should be displayed by default.
 *
 * Works out which of the two editors to display as the current editor for a
 * user. The 'html' setting is for the "Text" editor tab.
 *
 * @since 2.5.0
 *
 * @return string Either 'tinymce', or 'html', or 'test'
 */
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);
}

WordPress Version: 5.4

/**
 * Find out which editor should be displayed by default.
 *
 * Works out which of the two editors to display as the current editor for a
 * user. The 'html' setting is for the "Text" editor tab.
 *
 * @since 2.5.0
 *
 * @return string Either 'tinymce', or 'html', or 'test'
 */
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')) ? $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);
}

WordPress Version: 4.7

/**
 * Find out which editor should be displayed by default.
 *
 * Works out which of the two editors to display as the current editor for a
 * user. The 'html' setting is for the "Text" editor tab.
 *
 * @since 2.5.0
 *
 * @return string Either 'tinymce', or 'html', or 'test'
 */
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')) ? $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);
}

WordPress Version: 4.6

/**
 * Find out which editor should be displayed by default.
 *
 * Works out which of the two editors to display as the current editor for a
 * user. The 'html' setting is for the "Text" editor tab.
 *
 * @since 2.5.0
 *
 * @return string Either 'tinymce', or 'html', or 'test'
 */
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')) ? $ed : $r;
    }
    /**
     * Filters which editor should be displayed by default.
     *
     * @since 2.5.0
     *
     * @param array $r An array of editors. Accepts 'tinymce', 'html', 'test'.
     */
    return apply_filters('wp_default_editor', $r);
}

WordPress Version: 4.0

/**
 * Find out which editor should be displayed by default.
 *
 * Works out which of the two editors to display as the current editor for a
 * user. The 'html' setting is for the "Text" editor tab.
 *
 * @since 2.5.0
 *
 * @return string Either 'tinymce', or 'html', or 'test'
 */
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')) ? $ed : $r;
    }
    /**
     * Filter which editor should be displayed by default.
     *
     * @since 2.5.0
     *
     * @param array $r An array of editors. Accepts 'tinymce', 'html', 'test'.
     */
    return apply_filters('wp_default_editor', $r);
}

WordPress Version: 3.9

/**
 * Find out which editor should be displayed by default.
 *
 * Works out which of the two editors to display as the current editor for a
 * user. The 'html' setting is for the "Text" editor tab.
 *
 * @since 2.5.0
 *
 * @return string Either 'tinymce', or 'html', or 'test'
 */
function wp_default_editor()
{
    $r = user_can_richedit() ? 'tinymce' : 'html';
    // defaults
    if ($user = wp_get_current_user()) {
        // look for cookie
        $ed = get_user_setting('editor', 'tinymce');
        $r = in_array($ed, array('tinymce', 'html', 'test')) ? $ed : $r;
    }
    /**
     * Filter which editor should be displayed by default.
     *
     * @since 2.5.0
     *
     * @param array $r An array of editors. Accepts 'tinymce', 'html', 'test'.
     */
    return apply_filters('wp_default_editor', $r);
}

WordPress Version: 3.7

/**
 * Find out which editor should be displayed by default.
 *
 * Works out which of the two editors to display as the current editor for a
 * user. The 'html' setting is for the "Text" editor tab.
 *
 * @since 2.5.0
 *
 * @return string Either 'tinymce', or 'html', or 'test'
 */
function wp_default_editor()
{
    $r = user_can_richedit() ? 'tinymce' : 'html';
    // defaults
    if ($user = wp_get_current_user()) {
        // look for cookie
        $ed = get_user_setting('editor', 'tinymce');
        $r = in_array($ed, array('tinymce', 'html', 'test')) ? $ed : $r;
    }
    return apply_filters('wp_default_editor', $r);
    // filter
}