format_to_edit() - WordPress 函数参考中文文档

返回介绍

format_to_edit()

发布于 2017-09-10 字数2265 浏览 928 评论 0

format_to_edit( string $content,  bool $rich_text = false )

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.


参数

$content

(string)
(Required)
The text about to be edited.

$rich_text

(bool)
(Optional)
Whether $content should be considered rich text, in which case it would not be passed through esc_textarea().

Default value: false


返回值

(string) The text after the filter (and possibly htmlspecialchars()) has been run.


源代码

File: wp-includes/formatting.php

function format_to_edit( $content, $rich_text = false ) {
	/**
	 * Filters 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 ( ! $rich_text )
		$content = esc_textarea( $content );
	return $content;
}

更新日志

Version 描述
4.4.0 The $richedit parameter was renamed to $rich_text for clarity.
0.71 Introduced.

相关函数

Uses

  • wp-includes/formatting.php:
    esc_textarea()
  • wp-includes/formatting.php:
    format_to_edit
  • wp-includes/plugin.php:
    apply_filters()

Used By

  • wp-admin/includes/comment.php:
    get_comment_to_edit()
  • wp-includes/post.php:
    sanitize_post_field()

User Contributed Notes

上一篇:format_for_editor()

下一篇:format_to_post()

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!