0
我有这个代码,它工作得更早,但最近它停止工作,不知道为什么。添加帖子ID作为类到附件图像
function addclassfeaturedimage($attr) {
remove_filter('wp_get_attachment_image_attributes','addclassfeaturedimage');
$attr['class'] .= get_the_ID() ;
return $attr;
}
add_filter('wp_get_attachment_image_attributes','addclassfeaturedimage');
工作时,它将帖子ID添加到附件图像类。
任何想法?