Add Photos to an Envira Gallery with AI
New photos added to an Envira gallery, with alt text, after you see exactly what changes.
Prerequisites
A site connected to WPVibe running Envira Gallery 1.17.0 or newer (free) on WordPress 6.9 or newer, with an administrator account. Allow AI to edit galleries is turned on under Envira Gallery, Settings, AI & MCP. The new photos are already in your media library.
My WordPress site uses Envira Gallery. Add my photos of [what they show, or words from their titles] to my [gallery name] gallery. 1. Run discover_abilities with category envira-gallery. If the Envira Gallery abilities are not there, stop and tell me to install the free Envira Gallery plugin or update it to 1.17.0 or newer (it needs WordPress 6.9 or newer). Then run envira-gallery/describe-gallery-schema. If writes_enabled is false, stop and tell me to turn on Allow AI to edit galleries under Envira Gallery, Settings, AI & MCP in my WordPress admin, then ask again. 2. Run envira-gallery/list-galleries with search set to words from the gallery name and status any. If several match, show them with their photo counts and ask which one. If none match, run it again without search and show me the list. 3. If its image_count is over 200, don't read its photos: tell me the count, read only its sort setting with rest_api GET /wp/v2/envira-gallery/GALLERY_ID with context edit and _fields id,gallery_data.config.random, and go on (add-images reports photos already in it as existing and leaves them alone). Otherwise: Read the gallery's photos with rest_api GET /wp/v2/envira-gallery/GALLERY_ID with context edit, _fields id,status,gallery_data.gallery,gallery_data.config.random and max_length 4000000 (a read of one gallery takes any max_length; without it a long answer is cut). gallery_data.gallery lists its photos in order, each with id, title, alt and caption. If the answer still says it was cut (TRUNCATED), tell me the photo list is incomplete. Show me its photos in order as a numbered list with title and alt text; if it has more than 30, show the count and the last 10. If gallery_data.config.random is not 0, tell me visitors see the photos sorted (at random or by a field such as title or date), not in this order. 4. Find where the gallery is shown: run rest_api GET /wp/v2/pages and GET /wp/v2/posts, each with search envira-gallery, 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 a response says it was cut (truncated), lower per_page and read the rest; a post still cut at per_page 1, read alone with rest_api GET /wp/v2/pages/ID (or posts) with context edit, _fields id,status,content.raw and max_length 4000000. A post shows the gallery when its content has the envira-gallery shortcode with id set to GALLERY_ID (in double, single or no quotes; Envira's own block saves the shortcode inside it) or with slug set to the gallery's slug. This does not see galleries on other content types, such as products or courses, in synced patterns, or placed with a page builder widget, a theme template or a sidebar widget. Tell me where it is shown. If the gallery is a draft, tell me it shows nothing to visitors anywhere until it is published; if it is private, only signed-in users who may read it see it. If it is published, tell me visitors see the new photos as soon as they are added wherever it is shown, as this search can't see every place: a change to a gallery can't be saved as a draft first. If a shortcode that shows it has limit set, tell me that page shows only that many photos from the start, so photos added at the end won't show there. 5. Search my media library with rest_api GET /wp/v2/media with search set to my words, media_type image, per_page 50, context edit and _fields id,title,alt_text,caption,source_url. It matches every word in titles, captions and descriptions, so if nothing fits, try each word on its own. Leave out photos already in the gallery (from step 3, when you read them), show me the rest as a numbered list with title, alt text (or: no alt text) and link, and wait for my pick and its order. 6. Envira copies each photo's title, alt text and caption from the media library at the moment the photo is added, and the gallery keeps that copy: fixing alt text in the media library later does not change the gallery. So before adding, list the picked photos with no alt text and write alt text of about 125 characters or fewer for each, from the photo itself if you can see it at its link, otherwise from its title, caption and file name, marked as a guess. Show me the list and wait for my yes or edits. For each approved photo, run rest_api GET /wp/v2/media/ID with context edit and skip it if alt_text is no longer empty; otherwise save it with rest_api_write POST /wp/v2/media/ID with alt_text only. Never change alt text that is already there. 7. Show me what will be added, and wait for my yes. Then run envira-gallery/add-images once with the gallery_id and attachment_ids in my order. They go at the end of the gallery. 8. Run envira-gallery/get-gallery, and the gallery read from step 3 again if you made it. Tell me the photo count before and after, the titles added, and any in skipped (not in the media library, or uploaded by someone whose uploads this account can't edit) or existing (already in the gallery). Tell me the abilities can't take photos out: to undo, open the gallery in WordPress admin (Envira Gallery, then the gallery), select the added photos and remove them.
Skip pasting the full prompt. Drop this into your AI on a site that already has WPVibe:
Run the “Add Photos to an Envira Gallery with AI” recipe from the WPVibe cookbook on my connected site.
A gallery is never finished: new projects, this season’s menu, last weekend’s event. Adding photos means opening the gallery, searching the media picker and saving, and checking which ones are already in it, so galleries go stale.
Tell the AI which gallery and which photos. It shows you what the gallery holds now and where it is shown, searches your media library for the new photos, leaves out the ones already in it, and writes alt text for any that have none, saved after your yes. It adds what you pick in one change and reads the gallery back.
A change to a published gallery can’t be saved as a draft first: on a published page, visitors see the new photos as soon as they are added, so the AI asks first. New photos go at the end. The abilities can’t take photos out or change their order, and this recipe doesn’t try: to undo, remove them in the gallery’s edit screen. To start a new gallery, use this recipe.
Outcome
The gallery holds the photos you added, with alt text, after every photo it had before, and you know where it is shown.