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添加到附件圖像類。
任何想法?