这应该可以做到
add_filter(\'wp_get_attachment_image_attributes\', \'change_alt_image\', 10, 2);
function change_alt_image($attr, $attachment) {
$data_img = wp_get_attachment_image_src($attachment->ID, \'original\', false);
$attr[\'alt\'] = esc_url($data_img[0]);
return $attr;
}