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`是空的,过滤器将被应用于一个空字符串。

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
查看更多 >