How to remove post fields or options in WordPress with a SQL query

This article has been written before more than 1 years, information might old.

Sometimes a WordPress website can be very old and in the database you can find traces of many plugins or horrible themes and they are only a problem on your db.

With SQL it’s very easy clean everything.

delete FROM wp_postmeta WHERE meta_key rlike '_aioseop*';
delete FROM wp_options WHERE option_name rlike 'dialy_*';

As you can see the first command remove in the postmeta table, that table contain the post fields, all the field that have _aioseop at the start of the string and the * is a wildcard. In that way we say to remove all the row that start with that string without do many query.

Also the secondo one do the same thing removing stuff from options, where wordpress save the options, in the same way.

Obviously that queries require knowledge of the database and a backup because can remove important data of your website.

Leave a Reply

Your email address will not be published. Required fields are marked *

How to remove post fields or options in WordPress with a SQL query

time to read: 1 min
0