wp_default_editor

函式
wp_default_editor ( No parameters )
返回值
  • (string) Either 'tinymce', or 'html', or 'test'
定義位置
相關方法
wp_default_styleswp_enqueue_editorwp_default_packages_vendorwp_image_editorwp_editor
引入
2.5.0
棄用
-

wp_default_editor:此函式用於獲取站點的預設編輯器。它可用於確定編輯文章或頁面時使用的編輯器。

找出哪個編輯器應該被預設顯示。

找出兩個編輯器中的哪一個作為使用者的當前編輯器顯示。html”設定是針對”文字”編輯器標籤。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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 );
}
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 ); }
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 );
}

常見問題

FAQs
檢視更多 >