1. 首页
  2. WordPress钩子手册

format_to_edit

apply_filters( ‘format_to_edit’, string $content )

筛选挂钩:筛选要格式化以进行编辑的文本。
Filter Hook: Filters the text to be formatted for editing.

目录锚点:#参数#源码


参数(Parameters)

参数 类型 说明
$content (string) 文本,在格式化进行编辑之前。

源码(Source)

/**
 * Acts on text which is about to be edited.
 *
 * The $content is run through esc_textarea(), which uses htmlspecialchars()
 * to convert special characters to HTML entities. If $richedit is set to true,
 * it is simply a holder for the 'format_to_edit' filter.
 *
 * @since 0.71
 *
 * @param string $content  The text about to be edited.
 * @param bool   $richedit Whether the $content should not pass through htmlspecialchars(). Default false (meaning it will be passed).
 * @return string The text after the filter (and possibly htmlspecialchars()) has been run.
 */
function format_to_edit( $content, $richedit = false ) {
	/**
	 * Filter the text to be formatted for editing.
	 *
	 * @since 1.2.0
	 *
	 * @param string $content The text, prior to formatting for editing.
	 */
	$content = apply_filters( 'format_to_edit', $content );
	if ( ! $richedit )
		$content = esc_textarea( $content );
	return $content;
}
更新版本 源码位置 使用 被使用
1.2.0 wp-includes/formatting.php:2632 1 0

format_to_edit 为WP2原创文章,链接:https://www.wp2.cn/hook/format_to_edit-2/

发表评论

您的电子邮箱地址不会被公开。