示例:

<?php echo wpautop( $home_about, true ); ?> 
// 保留$home_about获取的内容中的换行。后台输入什么样,前台就什么样。

wpautop

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

<p>...</p>

),其余的换行转换成

<br />

语法:

<?php wpautop( $foo, $br ); ?>

说明:

$foo

(string) (required) The text to be formatted.
Default: None

$br

(boolean) (optional) Preserve line breaks. When set to true, any line breaks remaining after paragraph conversion are converted to HTML
. Line breaks within script and style sections are not affected.
Default: true