wordpress显示摘要并且保留html标签的代码


在function.php中添加以下代码:
add_filter('the_content', 'wpi_image_content_filter', 11);
function wpi_image_content_filter($content){
if (is_home() || is_front_page()){
$content = preg_replace("/<img[^>]+\>/i", "", $content);
}
return $content;
}