Skip to main content

Check What a Database Cleanup Will Delete Before You Run It with Advanced Database Cleaner and AI

One cleanup category opened and explained item by item, so you know what goes before you press clean.

Difficulty Beginner
Time ~5 min

Prerequisites

A site connected to WPVibe running Advanced Database Cleaner 4.3 or newer (tested on 4.3.1, free) on WordPress 6.9 or newer and PHP 8.2 or newer with OpenSSL, with "Expose plugin abilities" turned on in Advanced Database Cleaner, Settings, Developer integrations, and an administrator account, served over HTTPS.

The prompt
My WordPress site uses Advanced Database Cleaner. Before I clean up [the category, for example revisions, trashed posts, spam comments or expired transients], show me what it would delete. Don't change anything.

1. Run discover_abilities with category adbc. If no adbc abilities are listed, or a call answers adbc_abilities_disabled, stop and tell me to install or update the free Advanced Database Cleaner plugin (4.3 or newer, on WordPress 6.9 or newer and PHP 8.2 or newer with OpenSSL) and turn on "Expose plugin abilities" in Advanced Database Cleaner, Settings, Developer integrations. If a call answers adbc_application_password_required, stop and tell me the plugin runs its abilities only for an administrator connected over HTTPS.
2. Run adbc/get-general-data and find the category I named among its items (revisions, auto_drafts, trashed_posts, spam_comments, trashed_comments, unapproved_comments, expired_transients and the others it lists). Tell me its count and size. If I named none, use the biggest by size among revisions, auto_drafts, trashed_posts, spam_comments, trashed_comments, unapproved_comments, pingbacks, trackbacks and expired_transients, and tell me which.
3. Run adbc/get-items with itemsType set to that category, sortBy size, sortOrder DESC and itemsPerPage 50. List what is in it in plain words: for posts and revisions the title, date and size; for comments the author, the post ID and the date; for transients the name and size. If there are more than 50, say how many more.
4. Point out anything I might want to keep: revisions of pages I am still working on, trashed posts whose titles look like real content, unapproved comments from real people rather than spam. For trashed posts, the date shown is when the post was written, not when it was trashed, so ask me to check the titles. A date of 0000-00-00 means a draft that was never published.
5. Run adbc/get-keep-last and say whether a Keep last rule applies to this category (for example, keep the last 7 days, counted from each item's own date, which for posts is the date they were written, so it never keeps drafts that were never published). The count already leaves out what the rule keeps, and the cleanup deletes everything counted, not only the items you listed. A Keep last rule by days has no effect on categories without dates, such as expired transients and unused or duplicated meta. If no rule applies, say so.
6. Finish with what I should do first (restore an item, or set Keep last on Advanced Database Cleaner's General cleanup screen), then: back up the database, then run the cleanup there. Do not run any ability that changes something.
Already connected?

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

Run the “Check What a Database Cleanup Will Delete Before You Run It with Advanced Database Cleaner and AI” recipe from the WPVibe cookbook on my connected site.

A cleanup button is easy to press and hard to undo: a click can delete every old revision on the site at once. Most people either never press it, so the old data piles up, or press it without knowing what goes.

The AI opens one cleanup category in Advanced Database Cleaner, such as revisions, trashed posts or spam comments, and lists what is in it: which posts, how old, how big. It points out anything you might want to keep, names the plugin’s Keep last rule for that category if there is one, and changes nothing.

Use it before you clean anything. If the list holds something you need, restore it or set Keep last first. Then back up the database and run the cleanup on Advanced Database Cleaner’s General cleanup screen. For the whole picture first, use this recipe.

Outcome

A plain list of what one cleanup would delete, anything worth keeping, and the Keep last rule that applies, with nothing changed.