Home > CMS Tutorial > WordPress > body text

How to optimize and clean up redundant data in wordpress database

angryTom
Release: 2019-11-16 13:33:25
Original
2611 people have browsed it

How to optimize and clean up redundant data in wordpress database

How to optimize and clean up redundant data in wordpress database

Tip: Please back up the database before cleaning , to prevent accidents.

It has been found through practice that as long as the following five statements are executed in sequence, the cleaning can be relatively clean. Especially the wp_posts table, see how many records there are in this table. The number of records should be equal to the number of articles and pages you see in the background management interface.

DELETE FROM `wp_posts` WHERE `wp_posts`.`post_content` = '';
DELETE FROM `wp_posts` WHERE `wp_posts`.`post_title` = '';
DELETE FROM `wp_posts` WHERE `post_type` = 'revision';
DELETE FROM `wp_postmeta` WHERE `meta_key` = '_edit_lock';
DELETE FROM `wp_postmeta` WHERE `meta_key` = '_edit_last';
Copy after login

In addition, let me explain a table not mentioned above, wp_commentmeta, this table is the spam information record saved by the Akismet plug-in. If this table is not cleaned for a long time, You will find that it is much larger than other tables. Therefore, for a table like this, my suggestion is to clear it regularly. The SQL statement is as follows:

TRUNCATE TABLE `wp_commentmeta`
Copy after login

Recommended tutorial: WordPress Tutorial

The above is the detailed content of How to optimize and clean up redundant data in wordpress database. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!