1
我目前使用此功能从我的帖子中删除第一张图片,但是,我需要从特定类别的帖子中删除第一张图片。任何帮助深表感谢。wordpress函数删除特定类别帖子中的第一张图片
function remove_first_image ($content) {
if (!is_page() && !is_feed() && !is_feed() && !is_home()) {
$content = preg_replace("/<img[^>]+\>/i", "", $content, 1);
}
return $content;
}
//add_filter('the_content', 'remove_first_image');