WordPress默认方法输出内容时,会为编辑器内换行的内容自动加上<p>标签。
如果想去掉这个功能,可使用
remove_filter( 'the_content', 'wpautop' );
而有时,例如用了$post->post_content
会使这个功能失效,若想还原,可这样写
$content = $post->post_content;
$content = wpautop( $content );
同理可处理摘要the_excerpt()及评论内容comment_text().