pre_ent2ncr
云策文档标注
概述
pre_ent2ncr 是一个 WordPress 过滤器,用于在命名实体转换为数字实体之前过滤文本。开发者可以通过此 Hook 修改转换前的文本内容。
关键要点
- pre_ent2ncr 过滤器在 ent2ncr() 函数执行前被调用,允许干预文本转换过程。
- 过滤器必须返回非空字符串才能生效,否则可能影响后续处理。
- 参数包括 $converted_text(可空,默认 null)和 $text(原始文本),开发者需根据需求处理这些参数。
- 此过滤器自 WordPress 3.3.0 版本引入,相关代码位于 wp-includes/formatting.php 文件中。
代码示例
$filtered = apply_filters( 'pre_ent2ncr', null, $text );
原文内容
Filters text before named entities are converted into numbered entities.
Description
A non-null string must be returned for the filter to be evaluated.
Parameters
$converted_textstring|null-
The text to be converted. Default null.
$textstring-
The text prior to entity conversion.
Source
$filtered = apply_filters( 'pre_ent2ncr', null, $text );
Changelog
| Version | Description |
|---|---|
| 3.3.0 | Introduced. |