Removing old_slug and old_date from WordPress Database

I am trying to clean my database.

In the wp_postmeta table I see thousands of _wp_old_slug rows. I am not concerned about these old links not being redirected. What are the pros and cons of removing them?

See: https://www.farinspace.com/removing-wordpress-old-post-slug/

In the wp_postmeta table I see hundreds of _wp_old_date rows. I am not concerned about knowing when a post was originally written. I am only concerned about the most recent 'published on' date and want to continue displaying the most recent 'published on' date on posts. What are the pros and cons of removing them?

See: https://studiohyperset.com/wordpress-old-dates-historical-pre-1969-pre-1970-timestamp-function/#.Xv3KuyhKiUk

This website shows old tables and options rows developers often leave behind after uninstalling plugins.

See: https://plugintests.com/

Any other suggestions to clean the database and to keep it clean? Thank you.

Topic date slug database Wordpress

Category Web


Firstly it's great to clean up your database, and doing this may make some queries faster. Bear in mind that the size of the data in this case is small and these postmeta keys may not be often used so there is little value in removing them, especially if you find you need them late:

  • _wp_old_slug: This has the practical use of Wordpress being able to redirect old slug URL's to new ones. It could be very useful. Removing these may improve site speed for some queries if you can remove say 1,000's. Maybe some broken exernal links if you remove them, but you could keep these links working by manually adding redirects to e.g. .htaccess
  • _wp_old_date: I did not find all of the things this is used for, but it seems to be mostly used for e.g. _find_post_by_old_date(), however there are quite possibly other uses I didn't find. Again, you need to remove a lot of these (10,000+) to make any different to speed and the value of keeping these around could be high if you need them in future.

Your database may have data that's specific to you and your plugins, so a great way to keep your database working nicely would be to install the Query Monitor plugin and see if you have any long running queries, or plugins that run lots of queries or slow queries, and then figure out how to make these go faster.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.