{"id":378572,"date":"2026-10-05T08:38:48","date_gmt":"2026-10-05T08:38:48","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/codecaste-database-cleaner-optimizer\/"},"modified":"2026-10-05T08:38:16","modified_gmt":"2026-10-05T08:38:16","slug":"codecaste-database-cleaner-optimizer","status":"publish","type":"plugin","link":"https:\/\/pcm.wordpress.org\/plugins\/codecaste-database-cleaner-optimizer\/","author":15832969,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"1.0.0","stable_tag":"1.0.0","tested":"7.1.3","requires":"6.2","requires_php":"7.4","requires_plugins":null,"header_name":"CodeCaste Database Cleaner & Optimizer","header_author":"CodeCaste","header_description":"Scan WordPress database health, review optimization opportunities, and safely optimize supported records in controlled batches.","assets_banners_color":"","last_updated":"2026-10-05 08:38:16","external_support_url":"","external_repository_url":"","donate_link":"https:\/\/www.codecaste.com","header_plugin_uri":"","header_author_uri":"","rating":0,"author_block_rating":0,"active_installs":0,"downloads":179,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":{"1.0.0":{"tag":"1.0.0","author":"codecaste","date":"2026-10-05 08:38:16","revision":3728427}},"upgrade_notice":{"1.0.0":"<p>Initial release.<\/p>"},"ratings":[],"assets_icons":{"icon-128x128.png":{"filename":"icon-128x128.png","revision":3728426,"resolution":"128x128","location":"assets","locale":"","width":128,"height":128},"icon-256x256.png":{"filename":"icon-256x256.png","revision":3728426,"resolution":"256x256","location":"assets","locale":"","width":256,"height":256}},"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0.0"],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":3728426,"resolution":"1","location":"assets","locale":"","width":1271,"height":943},"screenshot-2.png":{"filename":"screenshot-2.png","revision":3728426,"resolution":"2","location":"assets","locale":"","width":909,"height":755},"screenshot-3.png":{"filename":"screenshot-3.png","revision":3728426,"resolution":"3","location":"assets","locale":"","width":931,"height":962}},"screenshots":{"1":"Dashboard with health score, overview stats, and Cleanup Items ready for review.","2":"Database Tables scanner listing possible leftover tables from removed plugins.","3":"Settings for batch size, revisions to keep, Action Scheduler retention, and active scanners."}},"plugin_section":[],"plugin_tags":[3786,153,1508,187,12113],"plugin_category":[52,59],"plugin_contributors":[282440],"plugin_business_model":[],"class_list":["post-378572","plugin","type-plugin","status-publish","hentry","plugin_tags-cleanup","plugin_tags-database","plugin_tags-health","plugin_tags-optimization","plugin_tags-transients","plugin_category-performance","plugin_category-utilities-and-tools","plugin_contributors-codecaste","plugin_committers-codecaste"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/codecaste-database-cleaner-optimizer\/assets\/icon-128x128.png?rev=3728426","icon_2x":"https:\/\/ps.w.org\/codecaste-database-cleaner-optimizer\/assets\/icon-256x256.png?rev=3728426","generated":false},"screenshots":[{"src":"https:\/\/ps.w.org\/codecaste-database-cleaner-optimizer\/assets\/screenshot-1.png?rev=3728426","caption":"Dashboard with health score, overview stats, and Cleanup Items ready for review."},{"src":"https:\/\/ps.w.org\/codecaste-database-cleaner-optimizer\/assets\/screenshot-2.png?rev=3728426","caption":"Database Tables scanner listing possible leftover tables from removed plugins."},{"src":"https:\/\/ps.w.org\/codecaste-database-cleaner-optimizer\/assets\/screenshot-3.png?rev=3728426","caption":"Settings for batch size, revisions to keep, Action Scheduler retention, and active scanners."}],"raw_content":"<!--section=description-->\n<p>CodeCaste Database Cleaner &amp; Optimizer is a WordPress database analysis and cleanup plugin designed to help administrators identify database bloat, unnecessary records, oversized tables, orphaned data and other potential database issues.<\/p>\n\n<p>The plugin follows a strict workflow: <strong>Scan \u2192 Analyze \u2192 Review \u2192 Clean<\/strong>. Scanning never modifies your data. Every cleanup action requires explicit administrator confirmation and runs in safe, batched steps so it works reliably even on large databases.<\/p>\n\n<h4>Included Scanners<\/h4>\n\n<ul>\n<li><strong>Autoloaded Options<\/strong> \u2013 total autoloaded option data and the largest individual options. A large autoload size is worth reviewing, but is not automatically unsafe.<\/li>\n<li><strong>Expired Transients<\/strong> \u2013 transient records that have already expired and are safe to remove.<\/li>\n<li><strong>Post Revisions<\/strong> \u2013 stored revisions beyond a configurable number of most-recent revisions to keep per post.<\/li>\n<li><strong>Auto-Drafts<\/strong> \u2013 abandoned auto-draft posts older than a day.<\/li>\n<li><strong>Orphaned Post Meta<\/strong> \u2013 postmeta rows whose post no longer exists.<\/li>\n<li><strong>Orphaned Term Meta<\/strong> \u2013 termmeta rows whose term no longer exists.<\/li>\n<li><strong>Orphaned Comment Meta<\/strong> \u2013 commentmeta rows whose comment no longer exists.<\/li>\n<li><strong>Action Scheduler Records<\/strong> \u2013 when Action Scheduler is present (e.g. via WooCommerce), old completed, failed and canceled actions.<\/li>\n<\/ul>\n\n<p>Potentially orphaned records are always clearly labeled as <em>potentially<\/em> orphaned so you can review them before cleanup.<\/p>\n\n<h4>Settings (explained simply)<\/h4>\n\n<p>Open <strong>DB Optimizer \u2192 Settings<\/strong>. Every option has a <strong>\"What does this mean? (example)\"<\/strong> link that explains it in plain language. After changing a value, click <strong>Save Settings<\/strong> and then <strong>Scan Database<\/strong> again so the Cleanup list uses your new value.<\/p>\n\n<p><strong>Cleanup Batch Size<\/strong> (default 500, range 50\u20135,000)<\/p>\n\n<p>Cleaning a large database in one go can overload your server, so the plugin cleans in small steps (\"batches\"). This number is how many records are removed in each step. It does <em>not<\/em> limit the total \u2013 the plugin keeps going until everything eligible is cleaned.<\/p>\n\n<p><em>Example:<\/em> you have 10,000 expired transients.<\/p>\n\n<ul>\n<li>Batch size 500 \u2192 20 steps of 500 records (the default, fine for most sites).<\/li>\n<li>Batch size 100 \u2192 100 smaller steps. Slower overall, but gentler on cheap shared hosting.<\/li>\n<li>Batch size 2,000 \u2192 5 big steps. Faster, but only use this on a strong server.<\/li>\n<\/ul>\n\n<p><em>Not sure?<\/em> Leave it at 500. Lower it only if cleanup shows an error or times out.<\/p>\n\n<p><strong>Revisions to Keep<\/strong> (default 5, range 0\u201350)<\/p>\n\n<p>Every time you click Update on a post or page, WordPress saves an old copy called a <em>revision<\/em>. This setting is how many of the newest revisions are kept <strong>for each post<\/strong>. Older ones become eligible for cleanup.<\/p>\n\n<p><em>Example:<\/em> the post \"About Us\" has 30 revisions.<\/p>\n\n<ul>\n<li>Keep 5 \u2192 the 5 newest are kept, 25 older ones can be cleaned (default).<\/li>\n<li>Keep 10 \u2192 the 10 newest are kept, 20 can be cleaned.<\/li>\n<li>Keep 0 \u2192 all 30 can be cleaned. You will no longer be able to restore earlier versions of that post.<\/li>\n<\/ul>\n\n<p><strong>Action Scheduler Retention (days)<\/strong> (default 30, range 1\u2013365)<\/p>\n\n<p>Plugins such as WooCommerce use a background task system called <em>Action Scheduler<\/em> (emails, syncing, subscription renewals and so on). Each task leaves a record behind, even after it has finished, and on busy stores these records can grow to hundreds of thousands of rows. This setting is how many days finished, failed or cancelled task records are kept before they can be cleaned. Tasks that are still waiting to run are never touched. It only applies when Action Scheduler exists on your site.<\/p>\n\n<p><em>Example:<\/em> today is 30 September. One finished task ran on 5 September (25 days ago) and another on 10 August (51 days ago).<\/p>\n\n<ul>\n<li>Retention 30 days \u2192 only the 10 August task can be cleaned (default).<\/li>\n<li>Retention 7 days \u2192 both tasks can be cleaned.<\/li>\n<li>Retention 90 days \u2192 neither can be cleaned yet; you keep a longer log for troubleshooting.<\/li>\n<\/ul>\n\n<p><strong>Scan History<\/strong> \u2013 keeps a record of every scan (date, size, score, issues, duration) on the History tab.<\/p>\n\n<p><strong>Active Scanners<\/strong> \u2013 switch off any scanner you do not want included in a scan.<\/p>\n\n<h4>Safety<\/h4>\n\n<ul>\n<li>Scanning never deletes data.<\/li>\n<li>Every destructive operation requires explicit confirmation.<\/li>\n<li>Cleanup endpoints never trust client-supplied record IDs; scanners derive eligible records from live database queries.<\/li>\n<li>Database-table deletion requires the exact table name and a fresh reference scan immediately before the DROP TABLE operation.<\/li>\n<li>Plugin, theme, must-use plugin, and WordPress content\/drop-in PHP sources are checked for common table references.<\/li>\n<li>Large cleanup operations use configurable batch processing to avoid PHP timeouts.<\/li>\n<li>All queries use the WordPress database API with prepared statements.<\/li>\n<li>All admin actions are protected by capability checks and nonces.<\/li>\n<li>The plugin never automatically deletes active plugin or theme data, and never performs automatic optimization.<\/li>\n<\/ul>\n\n<h4>Database Health Score<\/h4>\n\n<p>The dashboard shows a simple 0\u2013100 health score based on autoloaded data, table sizes, expired transients, revisions, orphaned metadata and Action Scheduler buildup. This score is an indicator, not an absolute technical measurement \u2014 large legitimate tables (for example WooCommerce order tables) are not automatically treated as unhealthy.<\/p>\n\n<h3>How it works<\/h3>\n\n<ul>\n<li><strong>Cleanup Items<\/strong> \u2013 everything the scan found, with record count and estimated size. Items that are already clean show a green tick.<\/li>\n<li><strong>Database Tables<\/strong> \u2013 custom WordPress-prefixed tables that appear to be left behind by plugins or themes that are no longer installed. Tables belonging to any currently installed plugin\/theme (active or inactive) are excluded. Deleting requires typing the exact table name.<\/li>\n<li><strong>History<\/strong> \u2013 the results of past scans.<\/li>\n<li><strong>Settings<\/strong> \u2013 the options described above.<\/li>\n<\/ul>\n\n<!--section=installation-->\n<ol>\n<li>Upload the <code>codecaste-database-cleaner-optimizer<\/code> folder to <code>\/wp-content\/plugins\/<\/code>, or install the zip via <strong>Plugins \u2192 Add New \u2192 Upload Plugin<\/strong>.<\/li>\n<li>Activate the plugin.<\/li>\n<li><strong>Take a database backup<\/strong> (recommended before any cleanup).<\/li>\n<li>Go to <strong>DB Optimizer<\/strong> in the admin menu and click <strong>Scan Database<\/strong>. Results appear straight away under <strong>Cleanup Items<\/strong>.<\/li>\n<li>Review each item, then click <strong>Clean<\/strong> on a single item, or <strong>Optimize All<\/strong>, and confirm.<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt id=\"will%20this%20plugin%20delete%20anything%20automatically%3F\"><h3>Will this plugin delete anything automatically?<\/h3><\/dt>\n<dd><p>No. Scanning never modifies data, and cleanup only runs after you explicitly review and confirm an action.<\/p><\/dd>\n<dt id=\"why%20is%20a%20table%20from%20an%20installed%20plugin%20not%20shown%20as%20an%20orphan%3F\"><h3>Why is a table from an installed plugin not shown as an orphan?<\/h3><\/dt>\n<dd><p>Database Tables is intended to find leftover tables from components that have been removed from the site. The scanner therefore inspects every currently installed plugin and theme, not only active components. This means a plugin that is installed but inactive can still have its custom database table protected from the orphan list. The scanner invalidates its source cache when the installed plugin\/theme inventory or the current database table set changes, so a newly installed plugin or a newly created custom table is not hidden behind an older 30-minute cache.<\/p><\/dd>\n<dt id=\"how%20does%20the%20scanner%20detect%20a%20custom%20plugin%20table%3F\"><h3>How does the scanner detect a custom plugin table?<\/h3><\/dt>\n<dd><p>The scanner checks current installed component source for WordPress table-prefix patterns, CREATE TABLE definitions, exact table identifiers, custom database\/table prefixes, and matching unprefixed table identifiers. It also keeps historical ownership information from earlier scans so a table can still be attributed after its plugin has been removed. Because WordPress\/MySQL does not store a universal creator field for arbitrary custom tables, the feature is intentionally described as possible orphan detection rather than absolute proof.<\/p><\/dd>\n<dt id=\"i%20ran%20a%20scan%20and%20%22items%20to%20clean%22%20shows%20a%20number.%20where%20are%20the%20items%3F\"><h3>I ran a scan and \"Items to Clean\" shows a number. Where are the items?<\/h3><\/dt>\n<dd><p>They are listed under <strong>Cleanup Items<\/strong>, right below the stat cards.<\/p><\/dd>\n<dt id=\"why%20did%20nothing%20change%20after%20i%20edited%20a%20setting%3F\"><h3>Why did nothing change after I edited a setting?<\/h3><\/dt>\n<dd><p>Settings apply to the next scan. Click <strong>Scan Database<\/strong> again to refresh the list.<\/p><\/dd>\n<dt id=\"does%20this%20support%20multisite%3F\"><h3>Does this support multisite?<\/h3><\/dt>\n<dd><p>The initial release targets standard single-site WordPress installs. Multisite support is planned for a future release since network and site-specific tables require additional handling.<\/p><\/dd>\n<dt id=\"what%20happens%20to%20my%20data%20if%20i%20uninstall%20the%20plugin%3F\"><h3>What happens to my data if I uninstall the plugin?<\/h3><\/dt>\n<dd><p>Deactivating the plugin leaves all of your WordPress data, plugin settings, and scan history untouched. Deleting the plugin from the Plugins screen removes only the plugin's own settings and scan-history records \u2014 it never touches your posts, comments, users, or other plugins' data.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.0.0<\/h4>\n\n<ul>\n<li>Initial release.<\/li>\n<li>Scanners for database &amp; table size, autoloaded options, expired transients, post revisions, auto-drafts, orphaned post\/term\/comment meta, and Action Scheduler records.<\/li>\n<li>Single-page dashboard with health score, stat cards, and a tabbed Cleanup Items \/ Database Tables \/ History \/ Settings layout.<\/li>\n<li>Batched, confirmation-gated cleanup for every supported scanner, plus an \"Optimize All\" runner.<\/li>\n<li>Database Tables scanner that flags possible orphaned tables left behind by removed plugins\/themes, with exact-name confirmation before any deletion.<\/li>\n<li>Scan progress bar and loader (scan buttons are disabled while scanning), Health Score stat card (0-100), \"Optimize All\" inside the Cleanup Items tab, and admin notices shown above the header.<\/li>\n<li>Unsaved-changes prompt when leaving the Settings tab, and Last Scan \/ History times shown in the site's timezone.<\/li>\n<li>Scan history log and a Settings screen with plain-language, example-based explanations for Cleanup Batch Size, Revisions to Keep, and Action Scheduler Retention (days).<\/li>\n<\/ul>","raw_excerpt":"Find out what&#039;s making your WordPress database large, identify potentially unnecessary data, and safely clean it after review.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/pcm.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/378572","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pcm.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/pcm.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/pcm.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=378572"}],"author":[{"embeddable":true,"href":"https:\/\/pcm.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/codecaste"}],"wp:attachment":[{"href":"https:\/\/pcm.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=378572"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/pcm.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=378572"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/pcm.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=378572"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/pcm.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=378572"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/pcm.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=378572"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/pcm.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=378572"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}