Skip to content

Repository files navigation

Content Cleanup Kit

Content Cleanup Kit is a WordPress admin plugin that audits, reports on, and safely fixes accumulated HTML debt in post content.

It targets long-running blogs and sites that predate the block editor — content written in the Classic Editor, imported from other platforms, or copy-pasted out of word processors and other websites. It adds a single admin page at Tools > Content Cleanup Kit with a scan → review → apply workflow.

Status: beta (0.3.0). The full rule catalogue and the scan → review → apply workflow are working. Back up your database and test on a staging site before running it against production content.

How it works

Every fix follows three principles: never modify content without confirmation, always preview the change as a diff first, and always allow recovery. A scan catalogues issues across your posts; the Scan Content screen lets you inspect each one as a side-by-side diff and apply it per row or in bulk. Each applied fix saves a native WordPress revision, so you can roll back from the standard post editor.

  • Read-only scanning in AJAX batches, designed for large sites.
  • Diff preview for every fixable issue before you commit.
  • Per-row and bulk apply, gated by an in-plugin confirmation modal.
  • CSV export of all findings.
  • Content inside <code> and <pre> is never modified.

What it checks

Each rule carries a severity (info / warning / critical) and is either auto-fixable, partially auto-fixable, or flagged for manual review. Rules can be enabled/disabled individually in Settings.

Deprecated tags

  • <b><strong>, <i><em>, <strike><s>, <acronym><abbr>
  • <font> removed (content kept), <center><div style="text-align:center">
  • <u> in body text — flagged for review

Heading structure

  • Strip redundant <strong>/<b> from inside headings
  • Remove empty headings
  • Flag skipped heading levels (e.g. h2 → h4) for review

Links

  • Unsafe target="_blank" — add rel="noreferrer noopener" or remove target (your choice)
  • Upgrade http:// internal links to https://
  • Convert absolute internal links to root-relative paths
  • Flag broken internal links (checked against the database) for review

Inline styles

  • Strip junk copy-paste spans (box-sizing / margin / padding noise)
  • Remove inline line-height from inline elements
  • Flag arbitrary inline color and font-size for review
  • Convert <p><small>…</small></p> to <p class="has-small-font-size">

Structural issues

  • Convert deprecated <a name> anchors to id
  • Remove <p>&nbsp;</p> spacer paragraphs and attribute-less empty <div>/<span>
  • Flag nested <p> and block-in-inline elements for review

Encoding & characters

  • Repair mojibake (éé, ’') from bad migrations
  • Convert typographic entities (&#8217;, &mdash;…) to real characters
  • Strip stray null bytes and control characters
  • Normalise mixed straight/curly quotes

External resources & accessibility

  • Upgrade insecure http:// iframes to https://
  • Modernise legacy YouTube embeds ([youtube] shortcodes and old iframes)
  • Flag hotlinked external images, images missing alt text, generic link text ("click here"), and tables without headers

The rules implement the full catalogue described in SPEC.md.

Requirements

  • WordPress 6.0+
  • PHP 8.0+

Installation

  1. Download the latest content-cleanup-kit-x.y.z.zip from Releases, or copy this plugin folder into wp-content/plugins/.
  2. Activate Content Cleanup Kit in the WordPress Plugins screen.
  3. Open Tools > Content Cleanup Kit, adjust scope in Settings, then run a scan from Scan Content.

Updates are delivered through GitHub Releases via the bundled Plugin Update Checker.

Safety

Content Cleanup Kit modifies post_content. Scans are read-only and nothing changes until you explicitly apply a fix. Each fix saves a WordPress revision you can restore from the post editor — but back up your database before running a bulk apply, and test on a staging site where possible.

Project structure

  • content-cleanup-kit.php — plugin bootstrap, metadata, autoloader, lifecycle hooks.
  • includes/class-plugin.php — tab registry and orchestration.
  • includes/class-rule.php, class-rules.php — the rule base class and registry.
  • includes/rules/ — one class per issue rule (detection + optional fix).
  • includes/class-scanner.php, class-fixer.php — batched scanning and the apply/preview engine.
  • includes/admin/ — the admin page and the Scan Content / Settings tabs.
  • assets/ — the shared scan-UI helper, confirmation modal, and CSS.
  • SPEC.md — the full design specification and rule roadmap.
  • CHANGELOG.md — development history.

Versioning

The version lives in the content-cleanup-kit.php plugin header (mirrored by the CCK_VERSION constant). Tagging vX.Y.Z builds and publishes a GitHub Release via the bundled workflow.

License

GPL-2.0-or-later

About

WordPress plugin that safely fixes accumulated HTML debt

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages