This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Deletes a media item from a gallery.
When a gallery item is deleted, the deleted gallery item is no longer returned when calling the listGalleryItems()
function.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function deleteGalleryItem(
identifiers: DeleteGalleryItemIdentifiers,
options: DeleteGalleryItemOptions,
): Promise<DeleteGalleryItemResponse>;
Gallery ID and Item ID.
import { proGallery } from "wix-pro-gallery-backend";
/* Sample galleryId value: 'f7cca0a0-5bb5-44c2-a0f8-6496430b3154'
*
* Sample itemId value: '5f3eae0d-cd93-47f8-af56-1442f37cf9bf'
*/
export async function myDeleteGalleryItemFunction(galleryId, itemId) {
try {
const deletedGalleryItemId = await proGallery.deleteGalleryItem({
galleryId,
itemId,
});
console.log("Success! Deleted the gallery item:", deletedGalleryItemId);
return deletedGalleryItemId;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
* {
* "itemId": "5f3eae0d-cd93-47f8-af56-1442f37cf9bf"
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.