Skip to main content
Cookbook Maintenance NextGEN Gallery

Check Your NextGEN Galleries for Problems with AI

Empty, missing, private, duplicated and unused NextGEN galleries found in one read-only report.

Difficulty Beginner
Time ~5 min

Prerequisites

A site connected to WPVibe running NextGEN Gallery 4.6.0 or newer (free) on WordPress 6.9 or newer, with an administrator account.

The prompt
My WordPress site uses NextGEN Gallery. Check my galleries for problems. Don't change anything.

1. Run discover_abilities with category nextgen-gallery. If the NextGEN Gallery abilities are not there, stop and tell me to install the free NextGEN Gallery plugin or update it to 4.6.0 or newer (it needs WordPress 6.9 or newer). Where a step says _fields inside query, put _fields in the query parameters, not in WPVibe's fields option, which on NextGEN's routes keeps whole nested blocks such as meta_data.
2. Run nextgen-gallery/list-galleries with per_page 50 and max_length 100000. While page is below total_pages, run it again with page raised by 1. If a response says it was cut (truncated), restart at page 1 with a lower per_page; never treat a cut list as complete. Note each gallery's id, title, display_type, image_count and page_id. Then run rest_api GET /imagely/v1/galleries with per_page 100 and _fields id,is_private,privacy,clientUrl (if 100 come back, read page 2 as well, and so on) to learn which are private.
3. Find every page and post that shows a gallery: run rest_api GET /wp/v2/pages and GET /wp/v2/posts, each four times, with search imagely, ngg, slideshow and imagebrowser, status publish,draft,private,pending,future, per_page 100 and _fields id (if a full page of 100 comes back, read the next page, and so on; an answer of rest_post_invalid_page_number means there are no more). Put the ids together without repeats, keeping pages and posts apart. If there are more than 40, tell me how many and ask before reading them; if I say no, tell me that what you report about where galleries are shown is incomplete. Read their content 10 at a time with rest_api GET /wp/v2/pages (or /wp/v2/posts) with include set to those ids, per_page 10, status publish,draft,private,pending,future, context edit, _fields id,title,status,link,content.raw and max_length 100000. If a response says it was cut (truncated), read those ids fewer at a time; if a post is still cut on its own, read it with rest_api GET /wp/v2/pages/ID (or posts) with context edit, _fields id,status,content.raw and max_length 4000000. Searches also match ordinary words, so a post may show no gallery at all. In each, note every gallery it shows and with which shortcode: the imagely shortcode and its id (the Imagely block saves one inside it), the nggallery, slideshow, nggslideshow, imagebrowser and nggimagebrowser shortcodes and their id, and the ngg and ngg_images shortcodes with gallery_ids or galleries, or with src or source set to galleries and ids or container_ids, in double, single or no quotes. Note any of those ngg or ngg_images shortcodes with neither display nor display_type set. NextGEN hides a private gallery's client page from every search: for each gallery with is_private true in step 2, read its page_id page alone with rest_api GET /wp/v2/pages/PAGE_ID with context edit and _fields id,status,link,content.raw, unless the searches already returned it, and note what it shows like the others. A public gallery's page_id is only a page link and its page is found by the searches. An ngg shortcode with only an id (no src, source, gallery_ids or galleries) points to a saved display, not a gallery: list it as not checked.
4. Add up image_count from step 2. If it is over 1,000, tell me and ask which galleries to check, offering the ones found on pages in step 3 first; read those one at a time with gallery_id, and name the ones not checked in the report. Otherwise read every gallery's images at once: rest_api GET /imagely/v1/images with no gallery_id, per_page 100, page 1, max_length 100000 and _fields inside query set to pid,galleryid,filename,image_slug,alttext,exclude,meta_data.md5 (if a full page comes back, read the next page, and so on; if a response says it was cut, restart at page 1 with a lower per_page). After each page, add to a short list per galleryid (how many images, how many need alt text, which pids in that gallery share a non-empty meta_data.md5, how many have exclude true) and work from that list, not the raw answers. An image needs alt text when its alttext is empty, is its file name (the same as its image_slug, or its filename with or without the extension), or is text a camera writes by itself, such as OLYMPUS DIGITAL CAMERA or SONY DSC. NextGEN gives an imported photo the media library caption as its alt text; with no caption, a title saved inside the photo file, if any; otherwise its file name. It never copies the media library alt text.
5. Flag, for each gallery: no images while it is on a published page or post (visitors see "no images were found"); private (is_private true) while it is also on a published page or post other than its client page (visitors see nothing there; on the client page, visitors with its password see it); display_type photocrati-nextgen_basic_tagcloud while it is shown with the imagely shortcode (visitors see image tags, not its photos); images in the same gallery that share a non-empty meta_data.md5 (the same photo imported twice, shown twice; the same photo in two galleries is fine); images that need alt text (give the count); images with exclude true (hidden from visitors; if all of them are, the gallery shows no photos); not found on any page or post (it may be unused, inside an album, shown by a random or recent shortcode, or on content this check can't see).
6. Flag every gallery id found on a page or post that is not in the list from step 2: that gallery was deleted, and the spot shows visitors nothing (the imagely shortcode) or "no images were found" (the older shortcodes); if I am not an administrator, it may instead be another user's gallery this account can't list. Flag every ngg or ngg_images shortcode from step 3 with neither display nor display_type set: on our test site, on a published page, such a shortcode showed nothing (add display, such as basic_thumbnail, or use the Imagely block).
7. Report each gallery with its title, image count, display, where it is shown and its problems, then the pages that point to a missing gallery, then the single most important thing to fix first. Offer, as next steps after my yes, the alt text recipe for a gallery with photos that need it.
Already connected?

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

Run the “Check Your NextGEN Galleries for Problems with AI” recipe from the WPVibe cookbook on my connected site.

Gallery problems are quiet. An empty gallery tells visitors “no images were found”, a deleted or private gallery leaves a blank spot or an empty message on a live page, photos imported twice show twice, and many imported photos carry their file name as alt text. Nothing tells you.

The AI lists every NextGEN gallery, reads its photos, and finds every page and post that shows one. It reports empty galleries on pages, pages that point to a gallery that is gone or private, photos in a gallery twice, photos whose alt text is missing or a file name, galleries set to a display that shows no photos, and galleries not on any page. It changes nothing.

The check finds galleries placed with the Imagely block or NextGEN’s gallery shortcodes on pages and posts. A gallery inside an album, on a product or other content, or placed with a page builder widget, a theme template or a sidebar widget isn’t seen, so a gallery listed as not on any page may still be in use. To fix alt text, use this recipe.

Outcome

A report of what is wrong with your galleries and where, with the first thing to fix, and nothing changed.