wp_default_editor() WordPress Function

The wp_default_editor() function sets the default WordPress editor. This function is used internally by the WordPress core to set the default editor for a user.

wp_default_editor() #

Find out which editor should be displayed by default.


Description

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.


Top ↑

Return

(string) Either 'tinymce', or 'html', or 'test'


Top ↑

Source

File: wp-includes/general-template.php

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 );
}


Top ↑

Changelog

Changelog
VersionDescription
2.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More