Support » Plugin: WP-Optimize - Clean, Compress, Cache. » Update to 2.2.12 will cause disasters!

  • Resolved BLwm


    The update cause several damages to the database.
    In my case, the plugin indicate 487 lost relationship. If you remove this, our multilanguage site lost relation between languages and many more problems.
    Keep away!

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author David Anderson


    Hi @blwm,

    Please can give us some information on the specifics of the data you lost? We are not aware of other problem reports, so we need some information to go on to investigate your problem. Are you able to describe any steps to reproduce the problem?

    If a MySQL table is in a corrupt state on-disk, then an “OPTIMIZE” command can cause data-loss. That’s why the plugin asks you to perform a backup before optimizing (and why it asks MySQL to try to detect if a table is corrupt first). But we’re not currently aware of other issues. Any info you have would be appreciated.


    Plugin Author David Anderson


    > In my case, the plugin indicate 487 lost relationship

    Can you tell us what plugin created these relationships? We may then be able to experiment.

    WordPress Version: 5.0.3
    WordPress DB Version: 43764
    PHP Version: 7.1.26
    MySQL Version: 5.6.42-84.2-log
    Web Server: Apache
    Web Server Protocol: HTTP/1.0
    Web Server HTTPS: Yes
    Theme: AIT DIrectory+

    The database, before optimization, seems have no problem and the whole site works perfectly.

    Plugin Contributor LumberHack


    Hi there @blwm

    I see that the theme is a premium one and we will need to test this to identify which specific relationships are lost.

    Please can you send us a copy of the theme here and we will get back to you.


    We don’t have a premium WP-Optimize


    I´m adding my inquiry to this, as it is also about lost relationships. In my case the relationships between articles, categories and tags in different languages that were created by the plugin Polylang (Pro), were detected by WP Optimize as orphaned relationships and therefore deleted. That never happened. which is why i also attribute this to your latest update.

    Unfortunately i noticed this after the backups that my hoster does in which everything was still fine, due to aging, were not available anymore.

    But anyway, as far as I can tell there is a bug in how the plugin categorizes what is an orphaned relationship. Maybe you also want to contact the people from Polylang to find out how they create and code these relationships, so you can find out better, what went wrong.

    Kind regards, Viktor

    Addition: Currently the plugin claims that I have over 360 orphaned relations
    Can´t be.
    Kind regards

    Plugin Author David Anderson


    @blwm Please can you let us know about the answer to the question “Can you tell us what plugin created these relationships? We may then be able to experiment.” ?

    In our testing we haven’t been able to reproduce this problem, and we need some help in doing so by knowing about the specifics of how to trigger it.

    @viktorleberecht Are you able to give us some steps we can reproduce with ? It looks a complex plugin, and the more info we can get, the better.

    It may well be that there are plugins that are storing data incorrectly in the linked WP relationship tables, and in that case, it probably will be best for us to just leave that “orphaned” data. But we really need to have a solid understanding before making a specific change, and steps to reproduce are the first important stage towards that.

    The problem involves the sites using Directory+ AIT theme AND WP-Optimize.

    WP-Optimize detect a lot of lost relationships that are not “lost”.
    This relationships involves:
    – direct relation between product categories translation
    – google maps custom markers
    – theme

    At the moment, as a security step, I have uninstalled WP-Optimize.

    The previous 2.2.11 don’t have this bug.


    I can´t give you any steps to reproduce, as WP-Optimize works automatically and Polylang does it´s job once the settings are done. All I can say is that I had not changed anything in both plugins, they had worked great, but as far as I can remember Polylang and WP-Optimize both had updates around the time, when WP Optimize suddenly showed lots of orphaned relationships.
    It was the relationships between categories and tags in different languages that were created by the plugin Polylang (Pro), that had never been a problem, and now suddenly were detected by WP-Optimize as orphaned relationships and therefore deleted. That never happened before. I´m now trying to determine which plugin was responsible.

    I informed the people of Polylang and gave them a link to this discussion thread so maybe you guys can work it ot.

    Kind regards,

    I got an answer back from Polylang: “we didn’t edit the relation ship code since 5 years”.

    So i guess the change that occurred and made this happen was in WP-Optimize?

    Kind regards,


    I am the author of Polylang.

    As far as I understand, WP Optimize offers an option to delete orphan taxonomy relationships.

    I found this in orphandata.php:

    $clean = "DELETE FROM <code>&quot; . $this->wpdb->term_relationships . &quot;</code> WHERE object_id NOT IN (SELECT id FROM <code>&quot; . $this->wpdb->posts . &quot;</code>);";

    The issue with this query is that it supposes that all taxonomies are related to posts which is not true. It’s indeed possible to register taxonomies on all sorts of object types outside posts.

    For example, WordPress registers the taxonomy ‘link_category’ for the object type ‘links’ which are stored in the $wpdb->links and not in $wpdb->posts. See:

    Other plugins such as BuddyPress and a few other register taxonomies on users. And Polylang registers taxonomies on terms.

    So there are many cases where deleting relationships with object ids not present in $wpdb->posts, deletes in fact relationships to valid objects.

    For your information, WP Sweep had the same issue some years ago. See

    In this plugin, the author already excluded the ‘link_category’ taxonomy from the check. He offered to exclude other taxonomies, although this partially kills the feature as orphans are checked only for taxonomies registered for post types.

    Plugin Contributor LumberHack


    Thanks @chouby and others on this thread.

    I will pass this information on, we should be addressing this shortly. I will update here as soon as its done.

    Hi everybody,
    just had the same issue today. I’m using polylang and after cleaning with the last version of wp-optimize more than half of my categories and tags were broken,no more showing up in their “edit article” boxes but still present and they also lost the connections with the equivalent categories in the second language.

    Even trying to save categories again and reconnect them between the two languages was unsuccessful, so I had to bring back the whole db from a backup!

    Thus I don’t have any log or details to give, but I’m going to rollback to an older version of wp-optimize (that also had a nicer interface showing the actual freed space).


    Plugin Author David Anderson



    This is believed to be fixed in WP-O 2.2.13 – sorry for the trouble. Please open a new topic if you are still experiencing trouble.


Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Update to 2.2.12 will cause disasters!’ is closed to new replies.