WP-Optimize Database Cleanup and Optimization Plugin for WordPress

wp-optimize logo

Download WP-OptimizeLatest version hosted at GitHub Official Plugin Repository

Preface

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.

Advertisement

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

Features:

MAJOR FEATURES:

  • 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.

Advertisement

Requirements:

  • 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

Installation:

  • 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.

Usage:

  • 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:

screenshot-1

Main Screen

screenshot-2

Settings Screen

screenshot-3

Tables View

screenshot-4

Mobile View 1

screenshot-5

Mobile View 2

Translators

FAQ

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

In Category: Wordpress
Show 289 Comments
  • Dorian February 24, 2013, 7:05 pm

    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 February 4, 2013, 12:31 am

    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.

    • Ruhani Rabin February 4, 2013, 5:14 pm

      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 January 31, 2013, 12:06 am

    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

    • Ruhani Rabin February 4, 2013, 5:14 pm

      It does not delete files or settings of WP

  • Stephane Briot January 15, 2013, 5:46 am

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

  • Mike December 10, 2012, 2:56 am

    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?

    • Ruhani Rabin December 11, 2012, 1:55 am

      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.

      • Mike December 12, 2012, 9:10 am

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

  • Rafael R. de Lima October 20, 2012, 4:49 am

    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?

    • Ruhani Rabin October 25, 2012, 1:25 pm

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

    • Ruhani Rabin November 21, 2012, 3:18 am

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

  • Ingar Sørensen October 8, 2012, 1:36 am

    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!

  • Юрий August 17, 2012, 10:51 pm

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

  • Omer Rosenbaum August 15, 2012, 7:02 pm

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

    • Ruhani Rabin August 16, 2012, 1:02 am

      I think that is a good idea. Thank you!

  • Sushant July 15, 2012, 6:11 pm

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

    • Ruhani Rabin July 16, 2012, 1:12 pm

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

  • Mairaj Pirzada July 1, 2012, 6:31 pm

    Great Plugin, thanks

  • Pilot June 10, 2012, 12:35 am

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

  • Szemcse June 1, 2012, 1:46 am

    Hi!
    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

    • Ruhani Rabin June 1, 2012, 11:10 pm

      Can you tell me which part? 

    • Szemcse June 3, 2012, 4:46 pm

      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 June 1, 2012, 1:17 am

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

    http://code.google.com/p/wordpress-wp-optimize/

  • Christopher February 21, 2012, 3:50 am

    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 ?

    • Ruhani Rabin March 15, 2012, 7:33 pm

      Christopher .. most probably the installation was incomplete.. 

  • Kat February 19, 2012, 1:46 am

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

  • Zulugogogo February 1, 2012, 3:13 pm

    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 January 16, 2012, 5:24 am

    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.

    • Ruhani Rabin January 16, 2012, 9:22 am

      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!

    • Ruhani Rabin January 16, 2012, 9:22 am

      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 November 12, 2012, 1:45 am

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

  • DynaPixels January 13, 2012, 1:10 am

    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 December 31, 2011, 1:47 pm

    Hi!
    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

    • Ruhani Rabin December 31, 2011, 8:54 pm

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

  • faddah December 31, 2011, 3:51 am

    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.

  • Brian Hayes December 31, 2011, 3:01 am

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

    • Ruhani Rabin December 31, 2011, 8:57 pm

      Yep considering it next version :)

  • Guest December 28, 2011, 10:45 pm

    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 December 29, 2011, 4:55 am

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

    • Ruhani Rabin December 30, 2011, 12:58 am

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

  • Eric Baaren October 31, 2011, 3:07 am

    can not optimize database althogh there is 256000 Kb overhead

    • Ruhani Rabin December 30, 2011, 12:55 am

      have you try to optimize using phpMyAdmin?

      • Tweetact December 30, 2011, 1:54 am

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

      • Ruhani Rabin December 30, 2011, 2:17 am

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

      • Tweetact December 30, 2011, 2:58 am

        is there a way to optimise a innodb anyway?

      • Ruhani Rabin December 30, 2011, 3:17 am

        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 December 30, 2011, 1:58 am

        btw.. thanks for answering

  • Marc_taylor October 11, 2011, 4:22 pm

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

    How do I fix this?

    • Ruhani Rabin December 30, 2011, 12:57 am

      .. 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

  • Christian Gabelli September 8, 2011, 12:54 pm

    the plugin has erased all post to my website!

    • Ruhani Rabin December 30, 2011, 12:56 am

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

  • Jogos Para Celular August 17, 2011, 11:56 pm

    vlw show esse plugin

  • Imraan August 15, 2011, 1:19 am

    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.

    • Ruhani Rabin December 30, 2011, 1:03 am

      This error is not related to the plugin.. 

  • Gia ca phe May 10, 2011, 3:23 pm

    great plugin

    tks

  • Happy May 10, 2011, 2:01 am

    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!

  • Kres Hans May 9, 2011, 3:54 pm

    thank for usefull plugin…

  • pay for essay May 4, 2011, 8:57 am

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

  • Anthony Butler April 13, 2011, 7:35 am

    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?

    Anthony

    • Ruhani Rabin April 13, 2011, 7:52 am

      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 :)

  • how to sell a business March 19, 2011, 8:59 pm

    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.

  • salvage yards March 18, 2011, 7:23 pm

    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.

  • free online dating March 17, 2011, 6:37 pm

    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.

  • Tim March 10, 2011, 2:35 am

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

    • Ruhani Rabin March 11, 2011, 11:31 am

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

  • Armiliansyah March 9, 2011, 7:13 am

    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

    • Ruhani Rabin March 11, 2011, 11:33 am

      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 March 9, 2011, 4:16 am

    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.

  • Webmaster990 March 8, 2011, 2:56 pm

    Thanks! This plugin is very useful!!!

  • Dapadoo Blogs March 6, 2011, 10:52 pm

    Hi, the plugin works but here are still security problem when using WP 3.1 multi-site. All admins even the ones that aren’t super admins can see and run WP Optimize from their blogs dashboards. They can see all the pages of all blog owners including the main blog.

    • Ruhani Rabin March 7, 2011, 1:32 am

      Thanks for the info but currently it is designed for the admins to see .. “Admins” and “Site Owner Admins” will be able to see .. I will take a look but it will take a long time because I am not catering for WP Multisites currently..

    • Dapadoo Blogs March 7, 2011, 9:28 pm

      Ruhani, with the new update to wordpress to WP 3.1 came some interesting changes. One of them is 2 dashboards for super admins. One is “Site Admin” the other is “Network Admin” I had to deactivate all my plugins and the reactivate them . I found some thing very interesting.

      WP Optimize shows up on the plugins of both dashboards. When I activated it on just the “Site Admin” plugins page other users on the multi-site could not see WP-Optimize options. So I’m happy to report at this time the WP-Optimize is working on WP 3.1 Multi-site with Buddy Press and bbpress acivated. If I come across any plugins that when activated cause WP-Optimiz to cause a problem I’ll let you know.

      • Ruhani Rabin March 8, 2011, 3:36 am

        Dapadoo :) I am really appreciating your feedback!

  • zonebattler March 3, 2011, 8:16 am

    Hi, I just realized that the WP Optimize configuration screen is accessible not only for admis, but also for authors. This seems to be a potential security hazard since it would allow users with restricted rights to change the username of others! I think that the use of WP Optimize should be granted to admins only.

    • Ruhani Rabin March 3, 2011, 3:57 pm

      I’ve just fixed this issue and will be updated in another few hours time.. thanks so much!

      • zonebattler March 3, 2011, 5:35 pm

        Hey, that’s what I call a quick reaction! Thank you very much indeeed, that solves the issue.

  • Elias Sarantopoulos March 1, 2011, 2:31 pm

    Ruhani,
    First of all thank you for this great plugin you have created and shared with us, it’s a gem! Quick question, do you think it will support 3.1? I run two sites and in both sites the plugin has disappeared from the menu. Any thoughts? Thank you!

    • Ruhani Rabin March 3, 2011, 4:04 pm

      Hi Elias, I am assuming you upgraded to new version BUT you didn’t read the included readme.txt file =)
      WP-Optimize has it’s own menu Icon now and it was already (Older version already supports 3.1) supported for 3.1.. The menu item didn’t disappeared .. take a look here .. http://j.mp/i2rfDm and visit the plugin at the WP repository.. =)

  • Fabrizio Pivari March 1, 2011, 10:09 am

    Do you think to support also the possibility to delete Tags don’t used?

    • Ruhani Rabin March 3, 2011, 4:05 pm

      I will keep this in mind .. hopefully someone would send me a tip to get all the unused tags.. I am afraid it might generate too many calls to mysql DB..

  • No February 26, 2011, 11:51 am

    This great plugin removes “revisions” but i checked my DB after the cleanup and i found records where “post_status”=”auto-draft”. This can be a new feature in the next version.

    • Ruhani Rabin February 26, 2011, 10:36 pm

      this feature has been added to version 0.9.1

  • Leo February 14, 2011, 7:18 pm

    Hi this is a good article… will this work for the latest 3.x Wordpress versions?

    • aditia February 21, 2011, 1:45 pm

      yes it works on wp version 3 too, I’m still using it

  • Unknown January 31, 2011, 9:22 am

    Hi there,
    I love this!
    Thanks so much!

  • Racing Diary January 29, 2011, 7:53 pm

    a very very good plug-in indeed! Thanks

  • Chuck January 19, 2011, 9:01 pm

    Great plugin, but I’m getting this message. Any suggestions? Thank you.

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in D:dev.alarmsearch.comwordpresswp-contentpluginswp-optimizewp-optimize-admin.php on line 343
    Table Size Status Space Save
    Table Size Status Space Save
    Optimization Results:

    Total Space Saved: 0 Kb

    • Ruhani Rabin January 24, 2011, 4:10 am

      Hi Chuck please upgrade your PHP to 5.2.xx and MySQL to 5.1.xxx versions..

    • Julian Gieseke February 8, 2011, 10:51 am

      what is your database-name? looks like the plugin is buggy with tables which have “-” in its name. (i know using “-” in var-, db- or tablenames is bad practice, but sometimes your hoster makes something like “userid-customname”…)

      @Ruhani please fix your plugin, add backticks to all database-queries. for this particular problem, its line 341 in wp-optimize-admin.php, replace existing line with this:
      $local_query = ‘SHOW TABLE STATUS FROM `’. DB_NAME.’`’;
      (pluginversion: 0.8.0)

      then it should work.

      • Ruhani Rabin February 26, 2011, 8:25 pm

        @juliangieseke I’ve upgraded the plugin to 0.9.1 including the fix you have provided. THANKS so much!

  • Levyjs January 16, 2011, 6:40 pm

    Just tried it on newest WP update as of Jan 16 2011 and it cleaned up old post revisions, optimized database tables. So far it works great. Thanks for the great plugin to make things run smoothly without clutter.

  • Jürgen January 16, 2011, 11:34 am

    Works.
    But Maybe you should move it from the Dashboard Submenu to Tools submenu. I think it makes more sense.
    And maybe you should adda new version to make clear that it works with 3.04 ass well

    • Ruhani Rabin January 24, 2011, 4:09 am

      Thank Jurgen, I am planning for that actually.. Due to much work on hand It’s being delayed a bit…

  • Varsayılan Haber December 15, 2010, 7:22 pm

    Thanks for the plugin

  • Fabrizio November 19, 2010, 9:13 pm

    Great post, great plugin thanks for sharing.

  • Vivek November 6, 2010, 2:08 pm

    I am getting following error message;

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in domain.com/wp-content/plugins/wp-optimize/wp-optimize-admin.php on line 343

    It was working fine, i see error after installing plugin ‘smf bridge’, I tried disabling that plugin and problem gone, so its in direct conflict with the plugin. Please correct it in next fix.

    Thanks.

  • ETARD THE LIFECASTER October 29, 2010, 1:50 pm

    this is a nice plugin dude & I wanted to say thanks for making it
    but also to let you know your website link on
    http://wordpress.org/extend/plugins/wp-optimize/ is broken
    http://wwww.ruhanirabin.com/contact/ you need to remove one of the w’s in www.

  • Celina September 22, 2010, 12:45 pm

    I tried changing my username from admin to something else, then logged out to try logging in with the new account. It really worked, but for some reason I have lost all my admin privileges! I am still Administrator and yet I cannot touch anything. My plugins that are not network activated are also deactivated.

    So frustrating. How can I fix this? It’s a major problem as my website content is blanked out. Please help, I would greatly appreciate it!

  • kelly watson September 20, 2010, 8:44 pm

    Great post, I have been looking for a solution to take the backup of my wordpress site :-)

  • Anonymous September 19, 2010, 10:50 pm

    sounds great.

  • Leo September 14, 2010, 1:48 pm

    Great plug-in. I just used it on my site and it did everything it was supposed to. Changed username and deleted revisions… ;o) Thank You.

  • Ruhani Rabin September 13, 2010, 10:15 am

    This plugin won't be able to make those type of problems. Check your permalinks structure, open your comments for that post etc. Also please provide a direct link to the problem. This plugin doesn't interfere with any wordpress settings.

  • Marion_Anderson September 13, 2010, 10:09 am

    Problem – applied plugin – comments closed on post and tweet button now showing question mark instead of tweet number. Can you help?

  • Irman August 27, 2010, 9:01 pm

    This plugin recomended by my frend masiqbal.net and I like this plugin. Thanks Brother

  • Otong August 24, 2010, 6:48 pm

    Like this plugins.. and thanks brader.. :)

  • Mohan23 August 6, 2010, 5:58 pm

    Worked fine for my WP3 blog :)

  • Kalian July 26, 2010, 3:15 pm

    1. I have “_” in db name, but my hosting automaticly creates names like user_dbname. Can I change something in plugin code to fix it?
    2. MySQL 5.1.47
    3. PHP 5.2.13

  • Ruhani Rabin July 22, 2010, 7:02 pm

    1. Check for “_” in your db name
    2. MySQL needed to be 5.1.xxx
    3. PHP needed to 5.2.xx

  • Kalian July 22, 2010, 6:58 pm

    On WP 3.0 have an error:

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /wp-content/plugins/wp-optimize/wp-optimize-admin.php on line 343

  • Ruhani Rabin July 19, 2010, 3:30 am

    Nope technically it can't crash WP … please check again.. I've checked it and it works with 3.0 (At least 3 of my Wp3 Sites)

  • Gwilson9564 July 19, 2010, 2:54 am

    I tried using it on my WP3 site and it crashed the site. I had to restore from my backup files. Not sure what happened.

  • Ruhani Rabin July 14, 2010, 8:57 am

    Some of my readers tested it with wp 3.0 and says it's working well

  • Gwilson9564 July 14, 2010, 1:05 am

    Has this been tested on WP3.0? Thanks…

  • Stehanov Peter July 8, 2010, 2:00 pm

    WARNING! It's a bug report!

    Be careful because when you use more different WordPress in same database (or anything else) it'll be “optimize” all of the table in that database!

    Developer(s): Fix it and keep up your good work! :)

    Peter

  • aditia July 5, 2010, 4:02 am

    hey thanks for the plugin very useful since a lot of revision post in my blog

  • Erdien July 3, 2010, 1:37 pm

    Thanks for this plug in. I really download it :)

  • Uninstall Program June 29, 2010, 3:49 pm

    Thanks for sharing this info!!

  • Ruhani Rabin June 29, 2010, 4:37 am

    In theory it should work. Have you tested it with MU?

  • air jordan 9 June 11, 2010, 7:49 am

    Here elaborates the matter not only extensively but also detailly .I support the
    write’s unique point.It is useful and benefit to your daily life.You can go those
    sits to know more relate things.They are strongly recommended by friends.Personally!
    http://www.you-rselfas.com

  • Greg Fielding June 9, 2010, 4:58 pm

    Will this work with mu?

  • air max shoes June 4, 2010, 1:36 am

    Well , the view of the passage is totally correct ,your details is really reasonable and you guy give us valuable informative post, I totally agree the standpoint of upstairs. I often surfing on this forum when I m free and I find there are so much good information we can learn in this forum!

  • Ruhani Rabin May 31, 2010, 10:05 am

    Yes I know about it but it makes more problems than solving it .. and the data chunk is not that big .. till i find a proper solution i will keep it how it is now.

  • air force one shoes May 31, 2010, 8:20 am

    Well , the view of the passage is totally correct ,your details is really reasonable and you guy give us valuable informative post, I totally agree the standpoint of upstairs. I often surfing on this forum when I m free and I find there are so much good information we can learn in this forum!

  • Crazy Girl May 27, 2010, 6:07 am

    Long time I am using your plugin and I am quite happy. But today I discovered some thing what you missed regarding revisions in your plugin. For any revision there will be even entries in postmeta and term_relationships tables. Your plugin only deletes the revisions in posts table.
    Could you update your plugin so that all relevant revision entries in the database tables will be deleted?
    Second question: How do I get rid of the other revision entries in postmeta and terms_relationship tables when no post revisions are existing anymore? Any idea?

  • Crazy Girl May 27, 2010, 6:06 am

    Long time I am using your plugin and I am quite happy. But today I discovered some thing what you missed regarding revisions in your plugin. For any revision there will be even entries in postmeta and term_relationships tables. Your plugin only deletes the revisions in posts table.
    Could you update your plugin so that all relevant revision entries in the database tables will be deleted?
    Second question: How do I get rid of the other revision entries in postmeta and terms_relationship tables when no post revisions are existing anymore? Any idea?

  • Ruhani Rabin May 22, 2010, 12:43 am

    Check php and mysql version … both needed to be above 5.xx

  • Ivan May 21, 2010, 7:20 pm

    Hi

    I get this error (WP 2.9.2):
    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/www/MYWEBSITE.dk/wp-content/plugins/wp-optimize/wp-optimize-admin.php on line 343

    Any idea?

    Best regards and tnx
    // Ivan

  • João May 11, 2010, 2:58 pm

    Hi,
    Great idea and seems well implemented, but there's something which is not clear to me. I have more than one blog using the same database (with different prefixes on the tables). Shouldn't WP-Optimize only show (and act upon) the tables of the blog from which dashboard it's being called?

  • Lacne znackove hodinky April 22, 2010, 3:07 pm

    Cool it does the work nicely. Like it. No need to be great technical person it is nice I like it. THNX from Slovakia

  • Electronic Cigarette Girl April 12, 2010, 3:57 pm

    Same here. Im seeing a substantial difference. Thanks :)

    -Bella

  • electronic cigarettes April 9, 2010, 12:26 am

    hi.
    thanks for the plugin. saves time

    -Xina

  • royalmice March 12, 2010, 12:17 pm

    Been using the plugin for some time now and very satisfied.
    I would like to suggest if possible to automate this. I have a autoblog farm of about 50 blogs, and having to go to each of them to run the optemising takes time, and i do it maybe ones a week.

    It would be great if this optimization process can be scheduled to run say daily . Maybe a cron job or something.

    Just my 2cent worth

  • Tatiane March 10, 2010, 1:23 am

    A good idea would be …
    add to the great plugin, an option to remove the tags that were not used in any post.
    :)

  • xrenovatio February 26, 2010, 5:42 am

    Thanks for this plugin. It has speed up my wordpress blog.

  • Rone February 26, 2010, 4:30 am

    Does this plugin work with the latest version of WPMU and BuddyPress?

    Thanks

  • Jeff Pinkham February 25, 2010, 2:11 pm

    Thanks, will give you feedback as soon as I've installed it

  • Volkher Hofmann January 26, 2010, 3:29 am

    Great plugin. I does exactly what it is supposed to do and works like a charm.
    Thank you!

  • twincascos January 24, 2010, 8:09 pm

    Hello ruhani,
    just wanted to say thanx for the plugin, saves me a few minutes.
    I wonder if there's a way to schedule it to do a weekly cleaning?
    Also echo scottwyden's comment bellow, merge with WP-DBManager and we're laughing.

  • gigi January 10, 2010, 2:26 pm

    Hello, i like to add the total space information.

    i would like to add this lines in your next version.

    in line 351 add line: $total_gigi+=$total;
    in line 399 add line: <?php $total_gigi = round ($total_gigi,3);?>
    in line 412 add line:

    <?php _e('Total space:', 'wp-optimize'); ?> <?php echo $total_gigi?> Kb

  • whatawebsite January 9, 2010, 8:18 pm

    Great plug-in
    Thanks
    Will

  • Richard Moreno January 9, 2010, 2:16 am

    Correction download link WP-Optimize 0.8.0: http://bit.ly/62QGvV

  • Richard Moreno January 9, 2010, 1:38 am

    Hi Ruhani,
    Thanks for the great plugin.
    Following is the translation Bazilian Portuguese: http://bit.ly/62QGvV
    ;)

  • marlin January 3, 2010, 6:44 pm

    Hey Rabin
    Thanks for this great plugin this is must use plugin for people like me who dont want to mess with phpmyadmin that always scared that something will surely go wrong.
    Thanks again

  • marlin January 3, 2010, 1:44 pm

    Hey Rabin
    Thanks for this great plugin this is must use plugin for people like me who dont want to mess with phpmyadmin that always scared that something will surely go wrong.
    Thanks again

  • hk_seo December 31, 2009, 1:02 am

    thanks for sharing i know some of them but for else thanks for it.

  • Wordpress Theme Design December 28, 2009, 5:20 am

    The Wordpress Development Team at Xieno has acquired a growth along with the growth of Wordpress itself. Our team is capable of providing almost any kind of solution, possible, in Wordpress. Despite of its powerful Bloging opportunity our Wordpress portfolio is consist of eCommerce Solutions, Photo Gallery, Social Networking, Link Directory, CMS enabled Informative Portal etc.

  • Ruhani Rabin December 23, 2009, 6:15 am

    I am thinking about that too :)

  • Ruhani Rabin December 21, 2009, 5:32 am

    Mia this plugin works as same as phpMyAdmin .. so it should work regardless
    wordpress versions.. but for the sake of safety .. why not backup your
    database also test is out on your local machine :)

  • MiaZoe December 21, 2009, 5:28 am

    Hi Ruhani , this is a great plugin ( Im quite new to all things Wordpress :D ) – and I just have 1 question : How compatible is this now to WP 2.9 ? [ I dont want to cause brain damage to my new version :D ] . Your response is greatly appreciated . Thank you :)

  • scottwyden December 15, 2009, 5:16 pm

    All you need is a database backup built in to the plugin and I can get rid of WP-DBManager

  • aks December 12, 2009, 8:25 am

    thanks for sharing i know some of them but for else thanks for it.

  • aks December 11, 2009, 5:16 am

    nice information and view about optimization.

  • glassyrajat December 9, 2009, 4:27 pm

    this plugin seems effecive & usefull.. cld save a lot of space & most best part to change tht boring “Admin” username to what u like !!!..

    Thanx

    Rajat Jain
    http://rajatresponsible.googlepages.com
    http://twitter.com/glassyrajat

  • allhimachal.com November 29, 2009, 12:42 pm

    hey Ruhani Rabin,
    thanks for awesome plugin :)

  • Hispania November 26, 2009, 1:20 pm

    hey, great plugin. I've uploaded to my blog and doing quite well but I would put it in Spanish, do not you have the file. Po to translate to my language?

  • Ruhani Rabin November 19, 2009, 3:52 am

    Requires mysql 5.1.x …. whats your version?

  • Alessia Heartilly November 19, 2009, 3:04 am

    Good morning,
    I'm getting this error with this plugin:
    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/sites/amazingreaders.net/public_html/wp-content/plugins/wp-optimize/wp-optimize-admin.php on line 343; I tried to optimize, but of course it doesn't work.
    I'm using Wordpress 2.8.5 and the last version of the plugin. Is there some way to solve the problem? Thanks!

  • jaume69 November 17, 2009, 6:04 am

    Hello, now works fine.
    I think.
    Thank you.

  • Ruhani Rabin November 16, 2009, 1:16 pm

    Yup Michael, I've just removed the code for POST META cleanup. Hopefully it
    will start working like it does before .. It used to be a flawless plugin..
    Please Get the update once it is available at the WP repository.

  • Michael November 16, 2009, 12:59 pm

    It's good that it cleans out old metadata, but it seems like it also cleans valid metadata for the actual post? That's a huge problem when working with thumbnails, as it can't retrieve the thumbnail URL any longer when metadata is gone. Bug maby?

  • Ruhani Rabin November 16, 2009, 6:20 am

    The post meta cleanup option added only on v 0.7.0 .. do you have problems with older version?

  • jaume69 November 16, 2009, 6:10 am

    But before with the version 2.8.5,not spent nothing and was well. ¿ ?
    Thanks.

  • Ruhani Rabin November 16, 2009, 5:54 am

    I'm going to remove the POST META cleaning option soon.. most probably that
    cleanup is making such problems..

  • jaume69 November 16, 2009, 5:43 am

    Hi,I have seen that with the latest version of Wordpress 2.9.6 there is a problem. In particular,when you put to optimize:Remove all Post revisions,after is the blank screen.With the other options does not pass.
    At best only problem mine.
    Thanks.

  • jaume69 November 16, 2009, 5:41 am
  • jaume69 November 16, 2009, 5:39 am

    Hi,I have seen that with the latest version of Wordpress 2.9.6 there is a problem. In particular,when you put to optimize:Remove all Post revisions,after is the blank screen.With the other options does not pass.
    At best only problem mine.
    Thanks.

  • Ruhani Rabin November 16, 2009, 2:52 am

    This could be your shared hosting problem even though I've tested with 5 different shared hosting providers, still no memory problems, unless you are using some other plugin which is blocking most of your allocated memory .. I've added the feature to clean up the post meta table on the 0.7.0 version of the plugin .. which requires slightly more memory but it is pretty low requirement .. please check your server logs and php error logs.. and let me know ..

  • Ruhani Rabin November 16, 2009, 2:50 am

    I haven't receive any problem reports like the one you've described .. it might be some other plugins .. i can't replicate this problem..

  • Carlos Guivara November 16, 2009, 2:48 am

    Ruhani any updates ?

  • Aurelian November 15, 2009, 7:44 am

    Hey there,

    I thought this plugin might help me but it didn't. I had PhotoJar installed and lost all the pictures on my website after the optimization. Do you have any idea on how to fix this?! I really wrecked up my things and i really need to fix it somehow. Did it save any backup or anything? Thank you.

  • JC November 14, 2009, 1:04 pm

    I'll second that. After upgrading to 2.86 wp-optimize no longer functions – it dies with memory allocation errors.

  • Carlos Guivara November 14, 2009, 5:32 am

    It's not working with 2.8.6 it log memory allocation errors

  • 小闇 November 14, 2009, 2:59 am

    I download the updated files before a moment.
    But it still does not work.
    In the previous reply, you said that the plugin must have mysql 5.1 and php 5.3.x, however, I can only use mysql 5.0 and 5.2.6.
    I think it is the reason why I cannot use the plugin.

  • Ruhani Rabin November 14, 2009, 2:41 am

    The minimum requirement is mysql 5.1 and php 5.3.x .. i've updated and
    checked the plugin yesterday

  • 小闇 November 14, 2009, 2:15 am

    My mysql version is 5.0, php 5.2.6 and apache 2.X
    Is there have any connection with the problem if I use old version of mysql?

  • Ruhani Rabin November 13, 2009, 1:23 pm

    I think the problem is with your mysql server upgrade.. You didn't mention the mysql server running. Also I did a test with 2.8.6 and found out it is working. Please check mysql version. for my test it was Apache 2.2, PHP 5.3, Mysql 5.1.

  • Ruhani Rabin November 13, 2009, 12:49 pm

    Just now I was testing with 2.8.6 and found out that the total number of
    kilobytes is not displaying correctly (empty).. But the plugin does the
    operations successfully ..

    I'm gonna take a deep look into it .. [EDIT]I've did some minor changes and it is fine now

    In the mean time, any tips/helps would be highly appreciated :)

  • sociolingo November 13, 2009, 12:42 pm

    Have you tested it out with the latest upgrade of WP – 2.8.6? it seemed a lot of things didn't work after 2.7 went to 2.8.

  • Ruhani Rabin November 13, 2009, 10:34 am

    Thanks so much for detailed report.. I am gonna test it out for any
    incompatibility issues and Will get back to you as soon as possible.

  • 小闇 November 13, 2009, 10:31 am

    Yesterday, I upgraded my MySQL in my host server.
    After the installation, I check my website, it is OK.
    But I found that there is a problem with WP-optimize.
    The picture with that problem: http://lh3.ggpht.com/_u_QFkzlEW20/Sv0ZFffgPFI/A

    As you see, there is a warning on “wp-optimize-admin.php”
    I don't know where is the problem is.
    So, I try to re-install the plugin, but it cannot recover.

    What's wrong with the plugin? (I am using WP version 2.8.6)
    Thank you to listen my questions.

  • gombile November 1, 2009, 2:12 am

    so i not need to login to PhpMyAdmin again to optimize my database table, thanks for your great plugin :)

  • jangeronimo October 31, 2009, 12:06 am

    I like that it frees up precious space by removing the bloat occasioned by post revisions. Love that. I'd install it now. :)

  • Ruhani Rabin October 26, 2009, 9:04 pm

    This is the first time someone saying the plugin deleted the drafts ..
    please check your installation. I will do a check also..

  • Zhu October 26, 2009, 6:17 pm

    Would have been perfect… except that the plugin deleted all my drafts (not the auto-save, the drafts) in my scheduled posts. Ouch!

  • Pierre October 21, 2009, 3:44 am

    Just tested now with 2.8.5 !
    worked great.

    Many Thanks

  • Amar October 20, 2009, 6:23 pm

    This is the first time i have visited this site, I am definitely going to try this plugin. Thanks

  • Tom October 14, 2009, 4:30 am

    I've got three different Wordpress sites, all the latest version. On one of them though, it seems to work, but the list of tables isn't shown. I only see the two grey heading bars.

    I tried deactivating/reinstalling but that doesn't help. What could be wrong here?

  • Ruhani Rabin October 2, 2009, 1:57 am

    For Safety Reasons it doesn't do that.. this is not a plugin cleanup tool..
    that can be too many variables in too many places

  • 24Seven October 1, 2009, 11:35 pm

    Giving the plugin a whirl now – Does it remove “old” database tables of plugins that have been removed?

  • Ruhani Rabin September 28, 2009, 12:32 pm

    Thank you so much for the FeedBack .. Appreciated..

  • Joseph September 28, 2009, 11:43 am

    The plugin works like a charm on WordPress 2.8.4. Tested all 5 options! :)

  • Harsh Agrawal September 28, 2009, 8:30 am

    John you still running old version.?? I hope you aware of the security bugs in old version..I will suggest upgrade it soon…

    • Ruhani Rabin September 28, 2009, 4:33 pm

      I second to Harsh.. agreed :)

  • Yohan Perera September 28, 2009, 4:44 am

    Yes it is according to 'lenghost'

  • Yohan Perera September 28, 2009, 4:42 am

    I tried it in my blog. Results were superb. I backed up my database as precaution, but the plugin optimized the core tables without causing any damage to the database.Thanks for the hard work.

  • Ruhani Rabin September 26, 2009, 11:11 am

    thanks so much you are awesome.. thanks for helping

  • lenghost September 26, 2009, 11:04 am

    tested with 2.8.4!
    It work fine.

  • Ruhani Rabin September 26, 2009, 7:56 am

    not tested yet .. can you help me test it? thanks

  • Roar September 25, 2009, 4:42 pm

    Is this tested in 2.8.4 yet?

  • reno September 9, 2009, 6:56 am

    Etait-il compatible WP 2.8.4 ?????

  • John September 2, 2009, 8:31 pm

    excellent plugin, works perfectly in wordpress 2.65

    would be useful if this could be scheduled to run automatically every day, or every few hours as i really notice a speed increase browsing my site after running wp-optimize.

    thanks for the great plugin!

  • minsk2 August 22, 2009, 4:45 pm

    Thank you! There are so many spam comments in my msql)))

  • wwday3 August 21, 2009, 7:36 pm

    One more request. Could you add the ability to clean up old RSS stored in the options table? That would be a great way to avoid “Magpie bloat”. I'm thinking maybe cleaning up RSS hash more than xx number of days old (select 20, 60, 90, whatever).

    Thanks

  • wwday3 August 21, 2009, 4:44 pm

    One quick, simple request. Could you add a total at the bottom of the size column? My host got a bit miffed at me for not tracking database size better. Your plugin is the best cleanup tool. If it gave me the total stat, it would be perfect.

    Any thought about having the cleanup kick off at regular intervals?

  • asean tourism July 20, 2009, 8:11 am

    I guess the best feature this plugin offers is to remove revision of the posts from db which its really nice, as you describe… it can take lots amount of db space, may be those revision are useful for some people, but I don't need that :mrgreen:
    Is it working on WP 2.8.1 ?
    What if you add another feature such to remove duplicate posts from db ? just a lil hope and thank you, gotta try this plugin :)

  • chiendent July 17, 2009, 1:36 pm

    Hello,
    Great pluggin I will use it for a blog on a 2.7 version. However
    what do I risk if I try to use WP-optimize with a 2.1 version? I can try to adapt the pluggin?

  • Ulla July 2, 2009, 12:27 pm

    Thank you for this excellent plugin. Экономит кучу времени!

  • Rajesh July 2, 2009, 4:21 am

    It is Good Tool, I have Posted my Review about this here: http://www.rajeshpatel.net/how-to-optimize-wordpress-database-performance/

  • Atul June 22, 2009, 9:59 pm

    will try it on mine blog thanks

  • eavasi June 5, 2009, 4:14 am

    Thank you so much for this plugin Ruhani!!! I like it so that translate it in russian and put it to download on my blog 'White Hat' www(.)eavasi(.)ru
    THANKS ONES MORE!!!

  • daily news June 4, 2009, 11:40 am

    nice post, good hack, thanks…

  • Ruhani Rabin May 29, 2009, 12:33 am

    the plugin doesn't touch any settings in the wp database .. it is like phpmyadmin in a very simpler interface.. so you can try optimizing the database using phpmyadmin .. the results should be the same.. in the mean time i look into it .. thanks for the feedback :)

  • ckenton May 27, 2009, 9:15 pm

    I tried your plugin on my wordpress/Thesis blog today. It worked for cleaning up the database, but caused some other problems that seem to mirror problems another commenter posted about. In my case, many of the blog's design settings disappeared–including each page's template assignment, and the column width/number settings. I had to deactivate the plugin, and go back and reset all the blog's design settings.

  • Ruhani Rabin May 27, 2009, 12:54 pm

    Hi Nawed, I've tested it with many blogs and until now I didn't find any problems regarding this.. Yours is the first ..

  • nawed karim May 20, 2009, 10:23 am

    I would like to add that i have also installed a plugin to remove common words from slug called remove stop word from slug by alberto avera and if this plugin has removed the post or your plugin wp-optimize is not clear. so it needs some R&D

  • nawed karim May 20, 2009, 6:48 am

    I dont know how it happened but after optimizing my database using your plugin around 30 of my post started ginving 404 error. i think if this plugin is not asking any table to optimize in red then the optimize button should not be clicked and i accidently pressed the optimize button to already optimized database and 30 of my post went missing.
    I found all those 30 article present in the post edit page of admin section and to restore the articles i used quick edit option and simply pressed update button and the article again came back sound and healthy. google indexed all those 30 article as missing and after troubleshooting i am hoping that google will not penalize my blog.

  • Lillea May 8, 2009, 4:20 am

    Thank you for creating this! I just got rid of 5 MB. My blog is rather new but I tend to edit my posts a lot.

  • Grump April 21, 2009, 9:12 am

    I have several blogs with from 400 posts to almost 8000 posts. My web host had to move me to my own server due to them causing so much lag. After running WP-Optimize on all my blogs, it saved just shy of 25mb!

  • Rob April 5, 2009, 3:38 pm

    the code is pretty straightforward but feel free to contact me by email.

  • Syed M. Ruhani Rabin April 4, 2009, 8:19 pm

    Thanks Rob for the excellent Idea.. I need to find some time to implement it :) Don't worry about the tabs, later i tab them again.. I might need to contact you directly about this, hope you wont mind :) again, thanks a LOT

  • Rohin April 4, 2009, 8:37 am

    very nice man ,

    Removed 1107 revision articles , and optimized size ; Total Space Saved: 8.1 mb

    thanks a million

  • Rob April 3, 2009, 12:28 pm

    Hello…
    Good plugin! However, part of deleting revisions should also be to get rid of all postmeta data associated with those revisions. Inserting the following code at line 74 of wp-optimize-admin.php will solve the problem:

    $allposts = get_posts(‘numberposts=-1&orderby=ID&order=ASC&post_type=any&post_status=’);
    $allpost_ids = array();
    foreach ($allposts as $onepost)
    $allpost_ids[$onepost->ID] = true;
    $cleaned_ids = array();
    $total_cleaned_metas = 0;
    $postmeta = $wpdb->get_results(“SELECT * FROM $wpdb->postmeta”, OBJECT);
    foreach ($postmeta as $meta)
    if (!isset($allpost_ids[$meta->post_id]) && !isset($cleaned_ids[$meta->post_id])) {
    $cleaned_metas = $wpdb->query(“DELETE FROM $wpdb->postmeta WHERE post_id = ‘”.$meta->post_id.”‘”);
    $total_cleaned_metas += $cleaned_metas;
    $cleaned_ids[$meta->post_id] = true;
    }
    $message .= $total_cleaned_metas.__(‘ postmeta items from revisions and nonexistant posts deleted’, $textdomain);

    i know, it looks a bit odd here, but the indentation will be in line with what’s in the file. ;) This includes a status message line (which could be omitted), and the admin prompt could possibly be rewritten a bit. Of course, this could as well also be another separate option / function of the plugin, as it gets rid of orphaned postmetadata in general, not only that which got left over by deleted revisions.

  • Rob April 3, 2009, 6:36 am

    Alright, so the comment form ate my indentation…. so indent as needed i guess. ;)

  • Rob April 3, 2009, 6:35 am

    Hello…
    Good plugin! However, part of deleting revisions should also be to get rid of all postmeta data associated with those revisions. Inserting the following code at line 74 of wp-optimize-admin.php will solve the problem:

    $allposts = get_posts('numberposts=-1&orderby=ID&order=ASC&post_type=any&post_status=');
    $allpost_ids = array();
    foreach ($allposts as $onepost)
    $allpost_ids[$onepost->ID] = true;
    $cleaned_ids = array();
    $total_cleaned_metas = 0;
    $postmeta = $wpdb->get_results(“SELECT * FROM $wpdb->postmeta”, OBJECT);
    foreach ($postmeta as $meta)
    if (!isset($allpost_ids[$meta->post_id]) && !isset($cleaned_ids[$meta->post_id])) {
    $cleaned_metas = $wpdb->query(“DELETE FROM $wpdb->postmeta WHERE post_id = '”.$meta->post_id.”'”);
    $total_cleaned_metas += $cleaned_metas;
    $cleaned_ids[$meta->post_id] = true;
    }
    $message .= $total_cleaned_metas.__(' postmeta items from revisions and nonexistant posts deleted
    ', $textdomain);

    I know, it looks a bit odd here, but the indentation will be in line with what's in the file. ;) This includes a status message line (which could be omitted), and the admin prompt could possibly be rewritten to indicate that postmeta data will be included in the cleaning. Of course, this could also be a separate option / function of the plugin, as it gets rid of orphaned postmetadata in general, not only that which got left over by deleted revisions.

  • mike April 1, 2009, 10:08 pm

    What an excellent plugin! My freelance $$$ are very tight right now however, next project I get will definitely make a donation. Thanks much.

  • Colin March 21, 2009, 10:31 am

    Sorry, that should have been is_ssl(), not is_sll().

  • Colin March 21, 2009, 10:30 am

    Wow, that was fast!

    I see that you closed the img tag, but that's not the cause of the https problem — that was one of two issues. The https access problem is because WP_PLUGIN_URL contains http rather than https, regardless of the access mode. Using bloginfo('url') will help with that, if the url is filtered elsewhere — that's how my fix works. An option, of course, is to insert some is_sll() php magic yourself, in your construction of the image url or in the WP_PLUGIN_whatever constants.

    Feel free to contact me via the mail address I'm posting with if I've managed to miscommunicate on this one.

    Colin

  • Ruhani Rabin March 21, 2009, 9:02 am

    Colin it's been updated with the fix :)

  • Ruhani Rabin March 21, 2009, 8:52 am

    Great! Thanks so much Colin .. Will release a Fix As soon as possible .. really appreciated your feedback :)

  • Colin March 21, 2009, 8:43 am

    Ruhani,
    First, thanks for the great plug-in!

    I've found that The WP-Optimize admin module has a couple of bugs in it. Here's the original code, from line #217 of the wp-optimize-admin.php file:

    <td colspan=”2″><img src=”<?php _e(WP_PLUGIN_URL) ?>/wp-optimize/wp-optimize.gif” border=”0″ alt=”WP-Optimize Admin” title=”WP-Optimize Admin”</td>

    This has two problems:
    1. It results in mixed content warnings from IE when accessed via https; the image URL ends up with http in it.
    2. The img tag is not closed.

    Here's my fix:

    <td colspan=”2″><img src=”<?php bloginfo('url'); ?>/wp-content/plugins/wp-optimize/wp-optimize.gif” border=”0″ alt=”WP-Optimize Admin” title=”WP-Optimize Admin” /></td>

    I'm also using a “HTTPS for WordPress” plugin, so the bloginfo call returns the appropriate url, with either http or https as the protocol, as appropriate. There may be other solutions, and without the additional plugin this might not work — but it works for me, for now.

    You might want to look into that.

    Thanks!
    Colin

  • Ruhani Rabin March 20, 2009, 8:59 am

    it's already queue for the next release :)

  • Alejandro March 19, 2009, 8:16 pm

    Will be cool a version where the user could program automatic cleans!

  • anton March 18, 2009, 4:10 pm

    Nice idea.. I like it. Thanks very much..

  • kovshenin March 13, 2009, 4:06 am

    Wow, sounds good to me! Thanks, I'll definitely try it out!

  • Ruhani Rabin March 9, 2009, 9:14 pm

    actually the plugin does everything how phpmyadmin works.. so if you've encountered mysql overhead .. you can try the same with phpMyadmin too.. it will give you same result… :) hope this helps.

  • vesket March 8, 2009, 3:24 pm

    Result from the next optimization (third today): Total Space Saved: 11269.391 Kb

    Changes since last optimization: Five small spams removed, none longer than 200 bytes

  • Ketil Vestby March 8, 2009, 1:30 pm

    This plugin is weird: I upgraded my backend-database today, from MySQL 4.2 to 5.1. Used the plugin to optimize the database before backing up. After restoring, the plugin found 13341.883 Kb of content to “optimize”.

  • Prasand J. February 23, 2009, 6:19 am

    I like this plugin a lot. I always hated to see so many revisions. However, is it possible to add an option to only keep the original and latest version, but delete all other revisions?

  • S February 17, 2009, 5:03 pm

    your plugin is phenomenal!

  • happy-buddha February 12, 2009, 9:18 am

    Wonderful ! Thanx !

  • John February 6, 2009, 8:19 am

    Wow! Zippier, smaller, tighter… this plugin is awesome and YOU are a star!

  • 0p0 February 5, 2009, 11:59 pm

    excelent plug!
    it made my site three times beter, I've been looking for something like this for a while
    thank you and keep up the good work! :D

  • George Serradinho February 2, 2009, 4:39 am

    Thanks for the plugin.

    I used it and there were over 700 post revisions in my DB.

    Keep up the good work

  • kaobear February 1, 2009, 8:51 am

    Wonderful Plugin

  • Ruhani Rabin February 1, 2009, 2:02 am

    @max, please don’t try to put everything to one direction and blame one thing. Most probably you’re database was already corrupted so the optimize command may do that..

    most probably your website does meet one of the following requirements

    1. your website running on less that a version of wordpress 2.7

    2. you are not running mysql 5.1.xx

    3. your database tables were corrupted

    and please post your comments in lowercase and sentence case.

    Also try to run in a local host or ubuntu box for testing.

  • Ruhani Rabin January 31, 2009, 6:02 pm

    @max, please don’t try to put everything to one direction and blame one thing. Most probably you’re database was already corrupted so the optimize command may do that..

    most probably your website does meet one of the following requirements

    1. your website running on less that a version of wordpress 2.7

    2. you are not running mysql 5.1.xx

    3. your database tables were corrupted

    and please post your comments in lowercase and sentence case.

    Also try to run in a local host or ubuntu box for testing.

  • max February 1, 2009, 12:37 am

    i think it has a very big problem!!!!!!!!!!!!!!!

    it erases me all my content!!!!!!
    big big big problem!!!!
    2hours of work to restabilish all!!!!!!

    a disaster!!!!!!!!!

    very sad…

  • Berrie Pelser January 29, 2009, 8:56 pm

    This works great Thx! :)

  • Berrie Pelser January 29, 2009, 12:56 pm

    This works great Thx! :)

  • Tom B. January 28, 2009, 2:22 am

    Just wanted to let you know, I have been using this on my blog with no problems (so far), with MySQL v4.0.27-max-log and PHP 4.4.9. I have optimized my tables, and about everything else except change my user name, and have had no error messages.

  • Tom B. January 27, 2009, 6:22 pm

    Just wanted to let you know, I have been using this on my blog with no problems (so far), with MySQL v4.0.27-max-log and PHP 4.4.9. I have optimized my tables, and about everything else except change my user name, and have had no error messages.

  • Tim January 27, 2009, 3:35 pm

    Currently I don’t have any tables in the list. Should I see a list of tables before I run any processes?

  • Tim January 27, 2009, 7:35 am

    Currently I don’t have any tables in the list. Should I see a list of tables before I run any processes?

  • Ruhani Rabin January 27, 2009, 7:19 am

    @Tim, glad it worked out.. tables report as you can see the 3rd column shows the optimization status, those table need to be optimized will be in red color stated ‘Need to optimize’ .. once you’ve run the optimize command those tables will be marked in Blue color stated ‘Optimized’

  • Tim January 27, 2009, 3:10 pm

    I’ve managed to change php to version 5.2.5 and it’s now OK. I assume that the tables report will not show anything until I actually run the optimizer?

    • Ruhani Rabin January 27, 2009, 3:19 pm

      @Tim, glad it worked out.. tables report as you can see the 3rd column shows the optimization status, those table need to be optimized will be in red color stated ‘Need to optimize’ .. once you’ve run the optimize command those tables will be marked in Blue color stated ‘Optimized’

  • Tim January 27, 2009, 7:10 am

    I’ve managed to change php to version 5.2.5 and it’s now OK. I assume that the tables report will not show anything until I actually run the optimizer?

  • Tim January 27, 2009, 2:48 pm

    As far as I can see, I have the following:

    MYSQL Version : 5.0.67-community
    PHP Version : 4.4.8

  • Tim January 27, 2009, 6:48 am

    As far as I can see, I have the following:

    MYSQL Version : 5.0.67-community
    PHP Version : 4.4.8

  • Ruhani Rabin January 27, 2009, 8:45 am

    @Tim, what is your version of MySQL? This has been tested with mySql 5 and Php 5.

    @Gt, that option has been implemented, you can see how much total space can be saved.

  • Ruhani Rabin January 27, 2009, 12:45 am

    @Tim, what is your version of MySQL? This has been tested with mySql 5 and Php 5.

    @Gt, that option has been implemented, you can see how much total space can be saved.

  • Tim January 27, 2009, 2:08 am

    I have the latest version downloaded (twice now) and get this error message:

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/sites/timchurch.me.uk/public_html/blog/wp-content/plugins/wp-optimize/wp-optimize-admin.php on line 316

    I’m using wordpress 2.7

  • Tim January 26, 2009, 6:08 pm

    I have the latest version downloaded (twice now) and get this error message:

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/sites/timchurch.me.uk/public_html/blog/wp-content/plugins/wp-optimize/wp-optimize-admin.php on line 316

    I’m using wordpress 2.7

  • gt January 27, 2009, 12:28 am

    thanks for this plugin.

    I have a feature request:

    add a “total” row in the “tables report”, so we can easily see how many bytes will be saved by optimization and how much bytes take all wp related tables in the database.

    IMHO that would be very useful

    TIA and sorry for my english

  • gt January 26, 2009, 4:28 pm

    thanks for this plugin.

    I have a feature request:

    add a “total” row in the “tables report”, so we can easily see how many bytes will be saved by optimization and how much bytes take all wp related tables in the database.

    IMHO that would be very useful

    TIA and sorry for my english

  • Shimshon January 25, 2009, 2:34 am

    Thanks for the Plugin – finally I got my admin user name changed!

  • Shimshon January 24, 2009, 6:34 pm

    Thanks for the Plugin – finally I got my admin user name changed!

  • Ruhani Rabin January 24, 2009, 11:33 am

    @Michael Jäkel, The thought flew in my mind few times and I’ve did some R&D. It might make a impact on your mysql server, even can make some tables corrupted if you do too much optimization command on a mysql database. That is why I put it in selective mode. But I will try to find out a way to implement it in near future.

  • Ruhani Rabin January 24, 2009, 3:33 am

    @Michael Jäkel, The thought flew in my mind few times and I’ve did some R&D.; It might make a impact on your mysql server, even can make some tables corrupted if you do too much optimization command on a mysql database. That is why I put it in selective mode. But I will try to find out a way to implement it in near future.

  • Michael Jäkel January 24, 2009, 7:06 am

    Great Plugin works fine.
    Is that a way that i start it automaticaly every Hour to auto optimize the Database Tables ?
    I use only the “Optimize database tables” function.

    Best regards DD6VD

  • Michael Jäkel January 23, 2009, 11:06 pm

    Great Plugin works fine.
    Is that a way that i start it automaticaly every Hour to auto optimize the Database Tables ?
    I use only the “Optimize database tables” function.

    Best regards DD6VD

  • baron January 23, 2009, 11:31 pm

    hi. Thanks for plugin

    perfect.

    Regards

  • baron January 23, 2009, 3:31 pm

    hi. Thanks for plugin

    perfect.

    Regards

  • lord January 23, 2009, 8:38 pm

    Something i’ve been looking for a long tim. works perfectly with 2.7. Thanks for this awesome plugin

  • lord January 23, 2009, 12:38 pm

    Something i’ve been looking for a long tim. works perfectly with 2.7. Thanks for this awesome plugin

  • Ruhani Rabin January 22, 2009, 3:04 am

    @Angelo : I think it’s better to wait until i release a stable version of the plugin. Because it’s not mature yet and i need to re-organize the codes too..

  • Angelo Gon January 22, 2009, 4:17 am

    @Ruhani

    Installed in other 3 of my blogs and no errors and working very fast.

    PS.:

    Maybe I can Translate to my language (Portuguese) one of my sites is about wordpress plugins and Im trying to translate all good plugins to portuguese (Brasil)

    Just drop me a line and I can translate the plugin

    regards

    • Ruhani Rabin January 22, 2009, 11:04 am

      @Angelo : I think it’s better to wait until i release a stable version of the plugin. Because it’s not mature yet and i need to re-organize the codes too..

  • Angelo Gon January 21, 2009, 8:17 pm

    @Ruhani

    Installed in other 3 of my blogs and no errors and working very fast.

    PS.:

    Maybe I can Translate to my language (Portuguese) one of my sites is about wordpress plugins and Im trying to translate all good plugins to portuguese (Brasil)

    Just drop me a line and I can translate the plugin

    regards

  • Ruhani Rabin January 22, 2009, 2:53 am

    @FridayKhutbah: Please re-download the plugin again and try. I guess there were 2 subfolders inside the plugin zip file.

    @Angelo: Thanks for the tryout. I’m planning to add some tweaking features too.

  • Ruhani Rabin January 21, 2009, 6:53 pm

    @FridayKhutbah: Please re-download the plugin again and try. I guess there were 2 subfolders inside the plugin zip file.

    @Angelo: Thanks for the tryout. I’m planning to add some tweaking features too.

  • Angelo Gon January 22, 2009, 2:32 am

    Really cool !

    Working like a charm!

    Any bug or error I will let you know.

    Best Regards

    ANgelo

  • Angelo Gon January 21, 2009, 6:32 pm

    Really cool !

    Working like a charm!

    Any bug or error I will let you know.

    Best Regards

    ANgelo

  • Friday Khutbah January 22, 2009, 2:00 am

    After Installing, I am getting error:

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in {path-to}pluginswp-optimizewp-optimizewp-optimize-admin.php on line 251

    I’ll check the code when I get home.

    Regards

  • Friday Khutbah January 21, 2009, 6:00 pm

    After Installing, I am getting error:

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in {path-to}pluginswp-optimizewp-optimizewp-optimize-admin.php on line 251

    I’ll check the code when I get home.

    Regards