Custom Post Type Cleanup

Description

Custom post type posts are left in the database if a post type is no longer registered (in use).

Plugins and themes can (without you knowing) use custom post types as a way to store data. These posts stay in the database forever if they’re not cleaned up by the plugin/theme itself upon deletion.

There are a lot of plugins that clean your database (by removing revisions, drafts etc.), but I haven’t found one that does a cleanup of unused post type posts.

This plugin provides an easy way to detect and remove posts from post types that are no longer in use. The settings page for this plugin is at wp-admin > Tools > Custom Post Type Cleanup.

Note: The proper WordPress delete function wp_delete_post is used instead of running a direct MySQL query to delete the posts. This way all associated post data (comments, post meta etc.) are also deleted from the database.

Since version 1.2.0 you can re-register unused custom post types for a limited period of time. This allows you to inspect and delete the posts like you would normally (in the wp-admin).

Screenshots

  • Plugin page
  • Plugin page after cleaning up all unused post type posts
  • Plugin page after re-registering unused custom post types.

Installation

Follow these instructions to install the plugin.

  1. In your WordPress admin panel, go to Plugins > New Plugin, search for “custom post type cleanup” and click “Install now”.
  2. Alternatively, download the plugin and upload the contents of custom-post-type-cleanup.zip to your plugins directory, which usually is /wp-content/plugins/.
  3. Activate the plugin
  4. Go to wp-admin > Tools > Custom Post Type Cleanup and see if there are unused custom post type posts in the database.

FAQ

Installation Instructions

Follow these instructions to install the plugin.

  1. In your WordPress admin panel, go to Plugins > New Plugin, search for “custom post type cleanup” and click “Install now”.
  2. Alternatively, download the plugin and upload the contents of custom-post-type-cleanup.zip to your plugins directory, which usually is /wp-content/plugins/.
  3. Activate the plugin
  4. Go to wp-admin > Tools > Custom Post Type Cleanup and see if there are unused custom post type posts in the database.

Reviews

Exactly what I needed

This plugin does exactly what it says it does and I appreciate that it does it using wp_delete_post instead of just a MySQL query. Well done!

What a great tool!

I tried a number of plugins before choosing the ones I stay using. Once I used this tool I saw what a junk they left. Even a Pagebuilder used Custom Content types. So I had a big cleanup thanks to this plugin. Saved me a lot of MB’s in the database!

Read all 4 reviews

Contributors & Developers

“Custom Post Type Cleanup” is open source software. The following people have contributed to this plugin.

Contributors

“Custom Post Type Cleanup” has been translated into 1 locale. Thank you to the translators for their contributions.

Translate “Custom Post Type Cleanup” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

1.2.0

  • Add ability to re-register unused custom post types.