wp_richedit_pre

函式
wp_richedit_pre ( $text )
引數
  • (string) $text The text to be formatted.
    Required:
返回值
  • (string) The formatted text after filter is applied.
相關
  • format_for_editor()
定義位置
相關方法
wp_htmledit_prewp_redirectwp_checkdatewp_editorrich_edit_exists
引入
2.0.0
棄用
4.3.0

wp_richedit_pre: 這是一個WordPress的過濾鉤子,用於在WordPress編輯器的內容被儲存之前對其進行過濾。它用於在內容被儲存到資料庫之前對其進行修改。

為富文字編輯器格式化文字。

這裡應用{@see ‘richedit_pre’}過濾器。如果`$text`是空的,過濾器將被應用於一個空字串。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_richedit_pre($text) {
_deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' );
if ( empty( $text ) ) {
/**
* Filters text returned for the rich text editor.
*
* This filter is first evaluated, and the value returned, if an empty string
* is passed to wp_richedit_pre(). If an empty string is passed, it results
* in a break tag and line feed.
*
* If a non-empty string is passed, the filter is evaluated on the wp_richedit_pre()
* return after being formatted.
*
* @since 2.0.0
* @deprecated 4.3.0
*
* @param string $output Text for the rich text editor.
*/
return apply_filters( 'richedit_pre', '' );
}
$output = convert_chars($text);
$output = wpautop($output);
$output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) );
/** This filter is documented in wp-includes/deprecated.php */
return apply_filters( 'richedit_pre', $output );
}
function wp_richedit_pre($text) { _deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' ); if ( empty( $text ) ) { /** * Filters text returned for the rich text editor. * * This filter is first evaluated, and the value returned, if an empty string * is passed to wp_richedit_pre(). If an empty string is passed, it results * in a break tag and line feed. * * If a non-empty string is passed, the filter is evaluated on the wp_richedit_pre() * return after being formatted. * * @since 2.0.0 * @deprecated 4.3.0 * * @param string $output Text for the rich text editor. */ return apply_filters( 'richedit_pre', '' ); } $output = convert_chars($text); $output = wpautop($output); $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); /** This filter is documented in wp-includes/deprecated.php */ return apply_filters( 'richedit_pre', $output ); }
function wp_richedit_pre($text) {
	_deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' );

	if ( empty( $text ) ) {
		/**
		 * Filters text returned for the rich text editor.
		 *
		 * This filter is first evaluated, and the value returned, if an empty string
		 * is passed to wp_richedit_pre(). If an empty string is passed, it results
		 * in a break tag and line feed.
		 *
		 * If a non-empty string is passed, the filter is evaluated on the wp_richedit_pre()
		 * return after being formatted.
		 *
		 * @since 2.0.0
		 * @deprecated 4.3.0
		 *
		 * @param string $output Text for the rich text editor.
		 */
		return apply_filters( 'richedit_pre', '' );
	}

	$output = convert_chars($text);
	$output = wpautop($output);
	$output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) );

	/** This filter is documented in wp-includes/deprecated.php */
	return apply_filters( 'richedit_pre', $output );
}

常見問題

FAQs
檢視更多 >