htmlburger / carbon-fields

WordPress Custom Fields Library ✨
https://carbonfields.net/
Other
1.4k stars 246 forks source link

Issue with carbon field `media_gallery` after image is deleted from wordpress media library #1256

Open uldisrudzitis opened 2 months ago

uldisrudzitis commented 2 months ago

Version

Expected Behavior

After deleting the image from wordpress media library the deleted image should disappear from carbon field media_gallery in the list.

Actual Behavior

After deleting the image from wordpress media library image in the carbon field media_gallery stays in the list as empty container even without the ability to delete it.

Screenshot 2024-09-20 at 09 05 32

Container definition

Field::make('media_gallery', 'gallery', __('Gallery'))->set_type(['image']),

Steps to Reproduce the Problem

  1. Choose the existing image from Wordpress media library using carbon field media_gallery and save the data.
  2. Delete the chosen image from Wordpress media library
  3. Check the saved data with carbon field media_gallery - empty grey container.

Comments

At least add the option to delete the non existing attachments. Auto remove from all the media_gallery lists would be perfect!