lesterchan / wp-sweep

WP-Sweep allows you to clean up unused, orphaned and duplicated data in your WordPress. It also optimizes your database tables.
https://wordpress.org/plugins/wp-sweep/
152 stars 23 forks source link

Whitelist meta info #66

Open AndreiIgna opened 4 years ago

AndreiIgna commented 4 years ago

Hi,

Haven't checked too much the plugin, but does it have functionality to whitelist and not delete specified meta info for posts? From a quick look the impression is that it deletes everything, which may break some websites.

For example it deletes meta data for nav_item created with this plugin https://wordpress.org/support/topic/wp-sweep-delets-if-menus/ Is there a possibility that plugins can do something like this?

<?php

add_filter('wp_sweep_whitelist_meta_keys', function($metas = []) {
  $metas[] = 'this-meta-key';
  $metas[] = 'that-meta-key';
  return $metas;
});

Cheers

lesterchan commented 4 years ago

Right now the plugin can't do whitelisted of post meta. But that is a good idea though I might not have time to do it anytime soon.

AndreiIgna commented 4 years ago

Ah okay.

Would be good to add a disclaimer text in meantime, to show that the plugin may break some websites and plugins.

The current text shown says about how data is deleted and only the good things about this. But while deleting those bits of info from database, some other parts may not work properly.

lesterchan commented 4 years ago

Agreed. There are improvements to be made WRT to working nice with other plugins. The use-case for this plugin when I built it is to clear as much data as possible and revert WP back to the original state. That is the reason why I did not include ways to play nice with plugins.

Some plugins left behind a lot of data as they don't clean up if the user uninstall them, so I wrote this plugin to fix that for my previous company.