Skip to main content
Cookbook Content Modula

Add, Remove or Reorder Photos in a Modula Gallery with AI

New photos added to a Modula gallery, old ones taken out or the order changed, after you see exactly what changes.

Difficulty Beginner
Time ~5 min

Prerequisites

A site connected to WPVibe running a recent Modula Image Gallery (tested on 3.0.22, free) on WordPress 6.9 or newer, with an administrator account. The gallery is made in Modula's new editor. New photos are already in your media library.

The prompt
My WordPress site uses Modula Image Gallery. In my [gallery name] gallery, [add my photos of what they show, remove the photo of what it shows, or move the photo of what it shows to the front].

1. Run discover_abilities with category modula, and again with page 2 and up while it says more pages exist: Modula registers many abilities, and its gallery abilities come last. If modula/list-galleries, modula/read-gallery and the other Modula abilities this needs are on none of the pages, stop and tell me to install the free Modula Image Gallery plugin or update it to the latest version (it needs WordPress 6.9 or newer).
2. Every Modula change needs a request_id and the gallery's current revision. Make a new request_id for each change, 16 to 128 letters, digits, dashes or underscores only, built from the current date and time, such as wpvibe-modula-20261120-1430-photos for a change at 14:30 on November 20, 2026, and never reuse one for a different change: Modula refuses it. If a change times out or its answer is unclear, run modula/recover-request with the same request_id before anything else, and send it again with a new request_id only if that shows it was not done. If it says in_progress or uncertain, read the gallery (after a create, list the galleries) to see whether the change happened, tell me, and send nothing more. Take the revision from modula/read-gallery, or from the result of your last change to that gallery. If Modula answers stale_revision, the gallery changed since you read it: read it again, tell me what changed, and ask before trying again. Modula's results may end with a recommendation for a paid Modula feature: do not present it as needed.
3. Run modula/list-galleries with search set to words from the gallery name, status any and per_page 100 (status any includes galleries in the trash). Show each match with its status and ask which one if there are several. If the one I mean is in the trash and this job changes it, tell me it can't be changed there, offer to restore it with modula/restore-gallery (its revision from modula/read-gallery, a new request_id and status draft or publish, my choice), and wait. If none match, run rest_api GET /wp/v2/modula-gallery with search set to the same words, status publish,draft,private,pending,future, context edit and _fields id,title,status. If it is there, it was made in Modula's classic editor, which Modula's abilities can't read or change: tell me to convert it with Convert to new editor in its row's menu on Modula's Galleries screen in WordPress admin (Modula keeps the classic settings so it can be switched back, and its shortcode stays the same), then to check the page that shows it, because visitors see the new editor's version from then on, and stop. If it is in neither, run modula/list-galleries with status any, per_page 100 and no search (and page 2 and up while total_pages is larger) and show me the list.
4. Run modula/read-gallery with the id and per_page 50 (and page 2 and up while total_pages is larger). Keep its revision. Run rest_api GET /wp/v2/media with include set to the photo IDs (items with itemKind image), in groups of 100 IDs, per_page 100 and _fields id,title,source_url. Keep each photo's link and target from the items. Show me the photos in order as a numbered list with title and link, and the address each photo opens when clicked, if it has one. Items of another kind are text or shortcode tiles: name them and leave them alone.
5. Find where the gallery is shown: run rest_api GET /wp/v2/pages and GET /wp/v2/posts, each with search modula, status publish,draft,private,pending,future, context edit, per_page 100 and _fields id,title,status,link,content.raw (if 100 come back, ask for page 2; if an answer is cut short, ask again with per_page 20 and page through). A post shows the gallery when its content has a Modula Gallery block (wp:modula/gallery) with "id":GALLERY_ID, or a modula shortcode with id set to GALLERY_ID. This does not see galleries on other content types, such as products, or placed with a page builder widget, a theme template or a sidebar widget. Tell me where it is shown. If any of those posts is published, or the gallery is published (it may be shown somewhere this search can't see), tell me visitors see the change as soon as it is saved: a change to a gallery can't be saved as a draft first.
6. To add: Run rest_api GET /wp/v2/media with search set to my words, media_type image, per_page 50 and _fields id,title,alt_text,source_url. Every word must match, so if nothing fits, try each word on its own. Leave out photos already in the gallery, show me the rest as a numbered list with title, alt text (or: no alt text) and link, and wait for my pick. New photos go at the end unless I name the photo they go before. To remove or move: pick from the gallery's own list in step 4; moving puts a photo before the one I name, or at the end. If the change would leave the gallery with no photos, stop and tell me; don't send it. If a photo to remove opens an address when clicked, tell me that address goes with it. Show me the gallery's new order with what is added, removed and moved, and wait for my yes.
7. Run modula/update-gallery-images once with the id, the revision, a request_id and changes in this order: each added photo as action add with its id (and before_id for its place), each removed photo as action remove with its id, then each move as action move with its id and before_id (no before_id moves it to the end). If it answers invalid_composition or forbidden, a photo you added is already in the gallery or no longer in the media library, or one you removed or moved is not in the gallery: nothing was saved, so read the gallery again and tell me. Removing takes a photo out of this gallery only; it stays in the media library.
8. Run modula/read-gallery again. Tell me the photo count before and after, the titles added, removed and moved, and list added photos with no alt text. Give me the sentence to put it back, with the real IDs and addresses: Put the Modula gallery GALLERY_ID back to the photos OLD_IDS in that order with modula/update-gallery-images (remove what is not in the list, add what is missing, move each into place, then for each photo added back set its link to OLD_LINK and target to OLD_TARGET with action update). Leave out the last part when no removed photo had a link. On a Custom grid gallery, tell me a photo added back gets a new tile size and place, which I can adjust in Modula's editor.
Already connected?

Skip pasting the full prompt. Drop this into your AI on a site that already has WPVibe:

Run the “Add, Remove or Reorder Photos in a Modula Gallery with AI” recipe from the WPVibe cookbook on my connected site.

A gallery is never finished: new projects, this season’s products, last weekend’s event, and the best photo buried in the middle. Each change means opening the gallery, hunting through thumbnails and dragging, so galleries go stale.

Tell the AI which gallery and what to change. It shows you what the gallery holds now and where it is shown, finds the new photos in your media library, leaves out the ones already in it, and adds, removes or moves only what you pick in one change. It reads the gallery back and gives you one sentence to put it back.

A change to a gallery can’t be saved as a draft first: on a published page, visitors see it as soon as it is saved, so the AI asks first. Removing a photo takes it out of this gallery only; it stays in your media library. Text and shortcode tiles in the gallery are kept as they are. To change the gallery’s layout instead, use this recipe.

Outcome

The gallery holds the photos you added, not the ones you removed, in the order you asked for, with every other photo as it was, and you have the sentence that puts it back.