format_for_editor()

最后更新于:2021-11-26 04:08:52

format_for_editor( string$text, string$default_editor=null)

Formats text for the editor.

参数

$text

(string) (Required) The text to be formatted.

$default_editor

(string) (Optional) The default editor for the current user. It is usually either ‘html’ or ‘tinymce’.

Default value: null

响应

(string) The formatted text after filter is applied.

源文件

文件: gc-includes/formatting.php

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