Skip to content

Commit 8e3982b

Browse files
authored
adding Alt to the generated images (#47)
1 parent f8f42ef commit 8e3982b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/MediaManager.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ public static function upload_to_media_library($media_path, string $title = null
3232
$attach_data = wp_generate_attachment_metadata($attach_id, $new_file_path);
3333
wp_update_attachment_metadata($attach_id, $attach_data);
3434

35+
// Update alt text
36+
if($title) {
37+
update_post_meta($attach_id, '_wp_attachment_image_alt', $title);
38+
}
39+
3540
return $attach_id;
3641

3742
}

0 commit comments

Comments
 (0)