How to Clean Database from Expired Transients in WordPress

Every WordPress developer who have ever looked into database knows that transients can leave big mess. There are couple of plugins that already do cleaning, but they have a few problems:

  • unnecessary complicated
  • don’t remove all transients
  • not multisite compatible
  • performing direct database calls for deletion

Since I didn’t like all of this, I created Clean Expired Transients. It is simple, hooks to native WordPress hook that runs once daily, cleans all transients older that one minute, and it’s multisite compatible.

You can call it any time using simple Clean_Expired_Transients::clean(); call from your custom code, or use it in your project.

It is also first plugin that I made available through Composer.

Leave a Reply

Comment Guidelines:
  • Your email address will not be published
  • Fields marked with * are required
  • If you want your picture next to comment, open an account at Gravatar
  • If you want to know if someone replied to your comment, check “Notify me of followup comments via e-mail”
  • You can use these HTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>