您可以使用wp\\u trim\\u extract创建函数来获取文本的第一段并忽略图像
function custom_excerpt($text, $raw_excerpt) {
if( ! $raw_excerpt ) {
$content = apply_filters( \'the_content\', get_the_content() );
$text = substr( $content, 0, strpos( $content, \'</p>\' ) + 4 );
}
// strip any images on the code
$text = preg_replace("/<img[^>]+\\>/i", "", $text);
return $text;
add_filter( \'wp_trim_excerpt\', \'custom_excerpt\', 10, 2 );