I’m dealing with some long-running WordPress blog. It was moved to different servers several times, and the migration process haven’t followed «the WordPress way» from time to time — just a database backup and restore with clean WordPress install.
So, now I see a lot of artifacts from obsolete plugins in database tables (options, cronjobs, etc).
I’m looking for a way to remove those traces.
To remove obsolete options from wp_options
I’m going to do the following:
- Backup, backup, verify that restore from backups works, backup once again.
- Extract all the option names from WordPress sources and currently installed plugins with some
grep
/sed
/awk
. - Run the following MySQL query:
DELETE FROM wp_options WHERE option_name NOT IN (%OPTION_NAMES_FROM_WORDPRESS_AND_PLUGINS%)
Will this work? How to deal with cron jobs? May there be any more artifacts to look for?