wordpress 函数:wpautop -云顶国际

将文本中的两个换行符转换成 html 段落 (

...

),其余的换行转换成

使用这个函数对日志内容和摘要进行格式化处理。

用法

参数

$foo
(string) (required) 将格式化的文本。
default: 无

$br
(boolean or integer) (optional) 保留换行符,当设置为 true ,段落转换完成之后余下的换行符将转换成

html 标签,script 和 style 后面的换行符不受影响。
default: 1

返回值

(string)
已经转换成正确段落标签的文本。

实例

输出结果:

some long text
that has many lines

and paragraphs in it.

注解

可以使用下面的代码取消 使用这个函数过滤日志内容和摘要:

remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );

修改记录

since: 0.71

源文件

wp-includes/formatting.php

         
网站地图