函数原型
format_to_edit( string $content, bool $rich_text = false ): string
函数描述
Acts on text which is about to be edited.
是否弃用
未弃用
函数参数
-
$content
string
Required - The text about to be edited.
-
$rich_text
bool
Optional - Whether
$contentshould be considered rich text, in which case it would not be passed through esc_textarea() .
Default:
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 | Description |
|---|---|
| 4.4.0 | The $richedit parameter was renamed to $rich_text for clarity. |
| 0.71 | Introduced. |

