WP-Optimize Database Cleanup and Optimization Plugin for WordPress

wp-optimize logo

Download WP-OptimizeLatest version hosted at GitHub Official Plugin Repository


I use WordPress solutions in a day to day basis. WordPress comes with a very extensible framework that allows you to add comprehensive and powerful functionality to your Blog system. WP-Optimize plugin is written to simplify your daily WordPress works simpler. WP-Optimize is a WordPress 3.8x database cleanup and optimization tool. It doesn’t need PhpMyAdmin to optimize your database tables. It allows you to remove post revisions, comments in the spam queue, un-approved comments, and many other junk within few clicks.


How this could help you?

  • Every time you save a new post or pages, WordPress creates a revision of that post or page. If you edit a post 6 times you might have 5 copy of that post as revisions. Imagine if your post or pages are long and big. It’s a huge number of bytes that is on your MySQL overhead. Now WP-Optimize allows you to optimize and shrink your posts table by removing not necessary post revisions from the database. As example, if you have a post which is approximately 100KB data and you have 5 revisions of that post, the total space wasted is about 500KB. And if you have 100 posts similar to it, you might have 50MB database space wasted.
  • Similar to the scenario described above, there might be thousands of spams and un-approved comments in your comments table, WP-Optimize can clean and remove those in a single click
  • WP-Optimize reports which database tables have overhead and wasted spaces also it allows you to shrink and get rid of those wasted spaces



  • Removal of stale post revisions
  • Removal of stale unapproved and spam comments
  • Removal of trshed comments
  • Mobile device friendly, now you can optimize your site on the go
  • Removal of all trackbacks and pingbacks
  • Cleaning up auto draft posts
  • Removal of transient options
  • Clear out the post trash
  • Automatic cleanup of all the integrated options (also uses retention if enabled)
  • Ability to keep selected number of weeks data when cleaning up
  • Option to add or remove link on wp admin bar.
  • Enable/Disable weekly schedules of optimization
  • Apply native WordPress MySql optimize commands on your database tables without phpMyAdmin or any manual query.
  • Display Database table statistics. Shows how much space can be optimized and how much space has been cleared.
  • Enabled for Administrators only.

All the potentially dangerous clean up options are marked RED.


When you use this plugin for the first time or just updated to major version, make a backup of your database. It is always the best practice to make a database backup before using this program first time.


  • Requires PHP 5.1.xx and MySQL 5.1.xxx
  • It Requires WordPress version 3.x and higher. Tested with 3.8beta
  • InnoDB Table formats not supported yet thus it would not optimize those table types


  • Unzip the archive into your hard drive.
  • Upload the folder to your wp-content/plugins folder on your web host.
  • Login to your dashboard and activate the plugin via activate option.
  • The menu item is – WP-Optimize ; can be found on your left side bar.


  • Select the WP-Optimize item under WP Admin.
  • Select the actions you want to perform.
  • Click on Process button.
  • Click on Settings to setup some options like what would you like to clean automatically on a period of time.

Screen Shots:


Main Screen


Settings Screen


Tables View


Mobile View 1


Mobile View 2



Can you help me restore my database?

No I can’t. Please make a backup of your entire database before using this Plugin for the first time. Also backup your database when you upgrade to a MAJOR NEW version (for example – v0.9.8 to 1.5.5 ).

Everytime I clear transient options, it comes back automatically

WordPress automatically creates transient options. It is pretty difficult to completley get rid of it. This is why everytime you clean transient options, you will notice new transient options has been created. My best advice would be clear the transient options on a schedule. So, for example it may create 50 transient option in a week and you clear it weekly so the next 50 transient option comes in. Rather than having 100 transient option, you will have 50 per week.

Optimization does not have any effect on database / it is not optimizing the database

Some of the shared web hosting company does not allow scripts to run OPTIMIZE command via SQL statements. If you are hosted with these web hosts, the optimize action will not be able to optimize your database. Please consult your web hosting company regarding this matter.

I am having error – Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource …  

  • Upgrade/Update your WordPress to at least 3.5
  • Upgrade/Update your WP-Optimize plugin
  • Upgrade your PHP to at least 5.1.xx
  • Upgrade your MySql to at least MySql 5.1.xx

Related Resources:

This is a primary version of the plugin so any feedback here would be highly appreciated. In addition to that you can post your feature/bugs or suggestions at GitHub.

Did this plugin helped you out?

Would you like to donate an amount or just buy me a coffee?
WP-Optimize Donation

  • Dorian

    Is it possible to run wp-optimize with a cron job? (a real cron job, not wp_cron) My searches on this topic have come up emtpy. Please advise. Thanks.

  • lautreamont

    Just now your plugin deleted my wp_usermeta and I was unable to log in to my account. My luck that was on my local comp and I have backup. Not complaining just informing you.

    • http://www.ruhanirabin.com/ Ruhani Rabin

      Hi there, thanks for letting me know. But the plugin does not have a code that can touch usermeta table.. so how it will be able to delete it? please check with a fresh local install and try it without any other plugin installed.:)

  • Mariangela

    Hi, it should be a great plugin but could I know the right way to compile it?In the past I used plugin that have deleted important file and I have my fears now!thanks a lot

    • http://www.ruhanirabin.com/ Ruhani Rabin

      It does not delete files or settings of WP

  • Stephane Briot

    A really goog plugin ! Must be used on every wordpress website (:
    Used it guys !

  • http://photokaz.com/ Mike

    My _options table always says “need to optimize”. I optimize using this plugin and also php myadmin. I can’t seem to make it go away. Any tips?

    • http://www.ruhanirabin.com/ Ruhani Rabin

      Please backup your complete database and try to run repair onto that options table. It may fix the issue. It can also be an issue about the DB format. But as i said.. please backup the DB first.

      • http://photokaz.com/ Mike

        I already tried to repair and optimize in php myadmin, still tells me I need to optimize.

  • http://www.oceucho.com.br/ Rafael R. de Lima

    I would like to clarify a doubt. If this plugin removes the table “wp-options” settings of uninstalled plugins, because when a plugin is reinstalled the old settings reappear?

    • http://www.ruhanirabin.com/ Ruhani Rabin

      No it doesn’t touch any of Wp-options table. It does not manipulate any values in tables except for clearing the revisions

    • http://www.ruhanirabin.com/ Ruhani Rabin

      As of now the plugin does not put anything specific to DB tables

  • http://www.facebook.com/ingarsorensen Ingar Sørensen

    You may want to free up some space but for most people it is most important that the page loads quickly. I’m sure my site was much faster after I Installing wp-optimize – Thank you so much!

  • Юрий

    Тоже поставлю!

  • Omer Rosenbaum

    Can you add to the next update a function that empties all the trashed posts?

    • http://www.ruhanirabin.com/ Ruhani Rabin

      I think that is a good idea. Thank you!

  • Sushant

    Have you removed that option which helps to change “admin” username?

    • http://www.ruhanirabin.com/ Ruhani Rabin

      Yes i did, it was causing a different level of problems regarding the username meta tags

  • http://www.kforknowledge.com/ Mairaj Pirzada

    Great Plugin, thanks

  • Pilot

    Hi, is it possible to schedule WP Optimize to optimize the DB tables say on a weekly basis? Or is this not adviseable?

  • Szemcse

    Error: The actual loaded translation content does not match the textdomain: wp_optimize
    Expect, that any text you translate will not occure as long as the textdomain is mismatching!
    This is a coding issue at the source files you try to translate, please contact the original Author and explain this mismatch.Warning: The actual loaded translation content contains mixed textdomains and is not pure translateable within one textdomain.
    It seems, that there is code contained extracted out of other plugins, themes or widgets and used by copy & paste inside some source files.
    The relevant comments: wp-optimize

    • http://www.ruhanirabin.com/ Ruhani Rabin

      Can you tell me which part? 

    • Szemcse

      Hello The downloadable version of the Spanish language file name was not good. For some reason, this edited, but once correctly renamed wp_optimize-es_ES.po file: wp-optimize-es_ES.po the issue is resolved.

  • Szemcse

    Hi I’ve done one of these … I look forward to the translators..


  • Christopher

    I upgraded to the latest version and it appears to have upgraded it’s self by deleting it self.  It’s not listed in the Plug-ins list ?

    • http://www.ruhanirabin.com/ Ruhani Rabin

      Christopher .. most probably the installation was incomplete.. 

  • Kat

    OMG. This was so easy to use! Thank you.

  • Zulugogogo

    Any thought to automating the optimize DB tables? I have found significant speed change running this every few days, so would be nice to automate

  • Chall

    I’ve been using WP Optimize on one of my sites for a year or more and love it. However, I was just getting ready to install the plugin on a site I maintain and I discovered that you’re dropped the security feature that allows the easy renaming of user “admin.” Why have you dropped this? It’s a pretty handy feature.

    • http://www.ruhanirabin.com/ Ruhani Rabin

      Hi Chall, Actually I dropped it because it may create some confusion when you want to create author based URL. It has something to do with author meta tags which I need to sort out. Thanks!

    • http://www.ruhanirabin.com/ Ruhani Rabin

      Hi Chall, Actually I dropped it because it may create some confusion when you want to create author based URL. It has something to do with author meta tags which I need to sort out. Thanks!

      • Steve

        Is there a way I can change the username so it will work for Authorship then?

  • DynaPixels

    This plugin really helped me to reduce from my database 104 MB to 84 MB

    Really thankfull to you. Keep up the good work.

  • Dennis

    Thanks for the cool WP-Optimize WordPress plugin. Now, the version 0.9.4 is out and I’m wondering, whether it will work on my site. At the moment I’m using WP-Optimize 0.9.2, that works with my MySQL 5.0.51a database. But does WP-Optimize 0.9.4 REALLY require MySQL 5.1.x? My webspace provider will NOT update to MySQL 5.1.x – so what can I do? Should I try it anyway or better stick to 0.9.2?Thanks in advance.Regards,Dennis

    • http://www.ruhanirabin.com/ Ruhani Rabin

      It should work because the core code is not touched .. only cosmetic changes.

  • faddah

    hi – i use your plug-in and like it. however, you just released a new, updated version of this plug-in, yet i can’t find a specific change list here for this new version. do you have posted here, and could you direct me to, please, a separate change list page for the versions of this plug-in, especially the latest version, that shows me exactly what has been fixed/changed/updated/added in this latest, current version? it would be most appreciated. thank you.

  • http://twitter.com/thoughtShopper Brian Hayes

    I’d like a ‘master check box’ so I don’t have to to click-click-click-click each selection. 

    • http://www.ruhanirabin.com/ Ruhani Rabin

      Yep considering it next version :)

  • Guest

    Very Very nice plugin. I for one however would love for the plugin to calculate the of the database as a whole with all tables. Your plugin currently calculates each tables size, and I can add these up but I would love for you to have a notice of the current database total size.

    • Tweetact

      you can write what you want here.
      You wont get an answer

    • http://www.ruhanirabin.com/ Ruhani Rabin

      I think it is a great idea .. I just need some time to make the patch and update.

  • Eric Baaren

    can not optimize database althogh there is 256000 Kb overhead

    • http://www.ruhanirabin.com/ Ruhani Rabin

      have you try to optimize using phpMyAdmin?

      • Tweetact

        Yes I tryed, but my database is in InnoDB, and people tell me you can not modifi it by hand

      • http://www.ruhanirabin.com/ Ruhani Rabin

        yes even phpMyadmin don’t support optimizing innoDB … hmmm .. sorry for late reply though.. 

      • Tweetact

        is there a way to optimise a innodb anyway?

      • http://www.ruhanirabin.com/ Ruhani Rabin

        I am currently investigating the issue.. whether possible or not. I will update the plugin in the mean time.. (will update again when i find a solution for innoDB)

      • Tweetact

        btw.. thanks for answering

  • Marc_taylor

    I ran the plug in now all I see on my home page is;
    “Error establishing a database connection”

    How do I fix this?

    • http://www.ruhanirabin.com/ Ruhani Rabin

      .. it merely optimize such as phpMyAdmin.. check your other plugins first then .. try to use phpMyAdmin to look at your database.. if you want to disable the plugin .. you need to delete the folder from /wp-content/plugins directory

  • http://www.facebook.com/gabelli Christian Gabelli

    the plugin has erased all post to my website!

    • http://www.ruhanirabin.com/ Ruhani Rabin

      The plugin can’t remove posts .. it merely optimize such as phpMyAdmin.. check your other plugins please.

  • http://www.celularesjogos.com Jogos Para Celular

    vlw show esse plugin

  • http://imraan.in Imraan

    i am having problem with this plugin. It is showing error on these 3

    Combine images into CSS sprites
    Leverage browser cachingDefer parsing of JavaScripthow to fix them ? Please guide me.

    • http://www.ruhanirabin.com/ Ruhani Rabin

      This error is not related to the plugin.. 

  • http://giacaphe.com/ Gia ca phe

    great plugin


  • http://www.selfimprovementtips.net Happy

    I heard about this plugin a while go but, lost the name of it. I’m so glad I found it again! It is going on all my blogs!

  • http://bisnishana.com/rahasia-jasa-adsense Kres Hans

    thank for usefull plugin…

  • http://anyessays.com/ pay for essay

    Thanks! good plugin especially for people who use WP every day! it’s really useful information.

  • Anthony Butler

    Great plugin – especially for getting rid of the dreaded auto draft posts. I have three blogs in the one database, using table prefixs. This seems to cause WP Optimize to ‘forget’ that it has optimised the tables as soon as it has done so. Is this a WP Optmize of MySQL problem?


    • http://www.ruhanirabin.com/ Ruhani Rabin

      Hi Anthony WPO directly talks to MySQL to get back the information to display .. you may want to run the optimization through PhpMyAdmin and check whether it acts in the same way. WPO works almost exactly the same way PhpMyAdmin works.. so PhpMyAdmin would act also forgotten the optimization .. in that case it is a MySQL problem.. you can get back to me on this :)

  • http://www.ibankr.com/ how to sell a business

    As a rule, plugin do a special kinds of work. This optimization plugin removes post revisions, spams and also optimize your database tables. It is a very useful discussion in this regard.

  • http://www.uneedapart.com/ salvage yards

    Everyone working with database management would like to optimize database tables and remove post revisions, spams with plugins. It is very useful and informative discussion on the subject. I appreciate the hard work.

  • http://www.thegobetween.com/ free online dating

    I am extremely glad to learn about the wp-optimize database cleanup and optimization plugin for wordPress. It is good to notice that this plugin removes post revisions, spams and optimize database tables. It is an excellent work.

  • http://ghosts-uk.net Tim

    Do you plan to bring in Multisite support at some point and if so do you expect it in months or much more?

    • http://www.ruhanirabin.com/ Ruhani Rabin

      I have plans for it but due to my workload it might take a bit while..

  • Armiliansyah

    Hi Rabin,
    Thanks for the great plugins. However, after I used it to optimize my WP sites, somehow I can’t upload images and i can’t install other plugins. It said “failed to create wp-content…”. Now I can’t put images to my WP sites. Can you please advise what should I do to fix this?

    Thanks in advance

    • http://www.ruhanirabin.com/ Ruhani Rabin

      WP Optimize doesn’t touch any settings of WP neigther the folders. Please consult your webhosting provider or check what other plugins have you installed.. Technically WPO cannot create this problem..

  • Brian

    Yes. WP Optimize is handy and smart. But why is it a unique drop down menu? A menu interface is precious. A tool is a tool. I’m surprised WP Optimize bullied its own screen real estate.

    • http://www.ruhanirabin.com/ Ruhani Rabin

      It was due to users requests..

  • Webmaster990

    Thanks! This plugin is very useful!!!