/ Wordpress

Wordpress删除文章内 空段落

functions.php 文件添加:

/** * 删除文章内

 

空段落 wpautop() / function remove_empty_p( $content ) { $content = force_balance_tags( $content ); $content = preg_replace( '#

\s+(<br\s*/>)?\s

#i', '', $content ); $content = preg_replace( '~\s?

(\s| )+

\s?~', '', $content ); return $content; } add_filter('the_content', 'remove_empty_p', 20, 1);

Wordpress删除文章内 空段落
Share this