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

Questo articolo รจ stato scritto oltre 1 years, il contenuto potrebbe essere datato.

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.

Liked it? Take a second to support Mte90 on Patreon!
Become a patron at Patreon!

Leave a Reply

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