Blog
lucija  

Post-Hack and Migration Prep: A Practical Cleanup Playbook for WordPress with Bulk WP

Messy databases slow everything down—especially after incidents, redesigns, or big content pushes. Spam posts, zombie users, orphaned taxonomies, stale meta from retired plugins, thousands of revisions, demo pages from theme trials… all of it taxes your queries, clutters search, and makes migrations riskier than they need to be. The good news: you don’t need raw SQL or a brittle script to fix it. You can run precise, repeatable cleanups directly in wp-admin and schedule hygiene so the mess doesn’t come back. This review-meets-how-to shows how to do that safely with Bulk WP and when to start with the free companion WPBulky.

TL;DR (Should you use it?)

If you manage busy sites—stores, magazines, LMS, or an agency portfolio—and routinely need to purge content by rules (status, taxonomy, custom fields, date, duplicates, user role, attachments, meta), Bulk WP is the quickest safe path. It’s faster than clicking through wp-admin, safer than custom scripts, and the scheduler turns cleanup into a habit instead of a fire drill.

Best for: post-hack recovery, pre-migration trimming, seasonal campaign leftovers, editorial hygiene on large archives
Skip if: you only need to delete a handful of items once; core tools may suffice

What Bulk WP actually does

Bulk WP specializes in deletion with guardrails. You define granular conditions, preview counts where available, process in batches to avoid timeouts, and optional schedules keep the database tidy automatically.

What you can target:

  • Posts & Pages: by category, tag, custom taxonomy, post type, status, creation date, visibility, URL, title (including duplicate titles), content, comment count, attachment presence, or custom fields

  • Users: by role or user meta (e.g., never logged in since registration)

  • Attachments: purge unused or incident-window uploads

  • Meta fields: post meta, user meta, comment meta

  • Taxonomy terms: by name or by post count (goodbye orphaned terms)

  • Other oddities: like Jetpack contact messages

Why that matters: editors get precision without SQL, ops get repeatability, and engineering gets fewer “can you run a script?” requests.

Why cleanup before a migration (or right after a hack)

Migrations are IO and CPU heavy. Moving a bloated database takes longer, introduces more opportunities for timeouts, and increases the chances of edge-case failures on the new host. Cleaning first means:

  • Faster export/import and less downtime

  • Less risk of indexing junk after DNS cutover

  • Smaller backup sets and quicker rollback options

  • Clearer post-migration QA because obvious noise is gone

After incidents (spam floods, compromised plugins), cleanups let you remove malicious content in controlled waves. Batching matters here—aggressive one-shot deletions can lock tables and cause more pain.

Day-one recipes you can copy

These are practical starting points. Adjust counts and windows to your context, run small batches first, then scale.

  1. Drafts older than 90 days
    Status = draft, Created < now−90d. You’ll typically clear hundreds of “someday” posts no one will finish.

  2. Abandoned pages
    Post type = page, Status = draft, Created < now−120d. Helpful after redesigns.

  3. Campaign leftovers
    Tagged test, temp, or inside a Campaign-Test category. Sweep after Q4.

  4. Orphaned terms
    Taxonomy term post count = 0. Great after switching category structures.

  5. Duplicate titles
    Identify and remove exact duplicate titles within the same post type (keep newest). This reduces search confusion.

  6. No-image drafts
    Drafts without a featured image older than 60 days. Editorial teams love this filter.

  7. Dead CPTs
    Type = old plugin CPT that’s been retired; Not publish; Created < now−365d.

  8. Dormant subscribers
    Role = subscriber, last_login meta is null, Registered < now−180d (align with your privacy policy before deleting users).

  9. Incident-window uploads
    Attachments added within a hack window or matching a filename pattern (e.g., suspicious zips).

  10. Revisions sweep
    Delete all post revisions weekly to keep tables lean.

Safety checklist you should actually follow

  • Fresh backups first (DB at minimum). Restoration beats regret every time.

  • Start on staging for complex/regex rules; then mirror to production.

  • Layer filters to narrow scope (status + age + taxonomy), don’t go broad at first.

  • Run small batches (10–50 items) and validate front-end/admin results.

  • Avoid overlapping schedules that might target the same content simultaneously.

  • Log outcomes in your ops notes or Slack: rule used, count removed, time window.

Post-hack recovery with control

When you’re cleaning after a compromise, the instinct is “nuke it all.” Don’t. Use targeted passes:

  • Spam posts/pages: filter by status (often publish), creation window (incident dates), and perhaps a giveaway in titles or content length.

  • Spam users: filter by role and user meta (never logged in, registered during the incident).

  • Suspicious media: date range + file type patterns.

  • Comment meta: remove injected URLs or suspicious keys.

  • Orphaned terms/meta: sweep to finish.

Process in batches to keep locks short and monitoring simple. After each pass, browse key templates to ensure nothing legitimate was in the blast radius.

Pre-migration trimming that shaves hours

Before a host move or a major version upgrade:

  • Purge old drafts and revisions

  • Remove obsolete CPT entries from retired plugins

  • Clear orphaned terms and meta

  • Trim user tables (dormant, test accounts)

  • Cut media not referenced anywhere important

This alone can turn a multi-hour migration into a sub-hour job, reduce risk of timeouts, and make your post-cutover crawl dramatically cleaner.

Scheduling hygiene so the mess doesn’t return

Most mess is cumulative. Set and forget a few jobs:

  • Weekly: delete revisions; clear trashed posts/pages; prune draft posts older than 90 days

  • Monthly: orphaned terms and comment meta; incident-window attachments if you had a flare-up

  • Quarterly: dormant subscribers per policy; campaign test content

Name schedules clearly (“Drafts >90d”, “Orphaned terms = 0”) and run the first cycle during off-hours while you watch server load.

How it fits with editorial workflow

Cleanup isn’t just ops. Editors benefit when the archive is searchable and consistent:

  • Create a short SOP: what gets auto-purged, when, and how to “protect” drafts that must survive a sweep (label them with a keep tag or move to a holding category).

  • After a sweep, run a quick dashboard report so stakeholders see counts removed; it builds trust in the process.

  • Pair cleanups with a media audit. Attachments are silent bloat and often the heaviest table.

Pros and cons from real usage

Pros

  • Granular rules that match how editors think (status, taxonomy, meta)

  • Batching to keep timeouts and table locks at bay

  • Schedules for hygiene without touching cron manually

  • Add-ons for advanced targeting (by content, custom fields, user role, attachments)

  • Safer than scripts, orders of magnitude faster than manual deletion

Cons

  • It’s deletion-only; you’ll still need a bulk editor for mass updates that aren’t removals

  • Power requires care—loose filters can remove more than intended if you skip the dry runs

  • No magic “undo”; you rely on backups, which is healthy discipline anyway

Setup and first cleanup in 10 minutes

  1. Install and activate the plugin.

  2. Choose a safe target like trashed posts or orphaned terms to get comfy.

  3. Define filters precisely (e.g., drafts + older than 90 days + specific taxonomy).

  4. Run a tiny batch and verify results.

  5. Scale up batch size or repeat until clear.

  6. Set schedules for recurring hygiene and watch the first run.

If you want to feel the flow before committing to PRO features, start with the free companion WPBulky. When you need scheduling, broader rule sets, and advanced add-ons, install Bulk WP across your production stack.

Performance gains you can measure

A lean database improves:

  • Query times and object cache hit rates

  • Admin screens (Posts, Media, Users) that used to crawl

  • Backup/restore speed and reliability

  • Migration time and risk

  • Search quality—less junk means better relevance

Track before/after with a few simple KPIs: DB size, average TTFB on archive pages, admin screen load in seconds, and backup duration. Cleanups pay for themselves quickly.

Who benefits most

  • Publishers and newsrooms: constant drafts and revisions demand recurring hygiene

  • WooCommerce stores: test products, seasonal leftovers, and heavy revision churn

  • LMS/memberships: dormant accounts and retired course content

  • Agencies: one SOP applied to dozens of client sites saves literal weeks per quarter

  • Sites recovering from incidents: controlled, auditable purges that won’t brick the dashboard

Verdict

Cleanup is one of the highest-ROI habits in WordPress ops. Doing it with precision, batching, and schedules is the difference between “we should tidy up sometime” and a stack that stays fast all year. For teams that want safety without SQL, repeatability without scripts, and migrations that don’t stretch into the night, Bulk WP is an easy recommendation. Start with one obvious win (old drafts or orphaned terms), validate on a small batch, schedule the job, and enjoy a quieter, faster dashboard.