Cleaning the WordPress database

(No ratings yet)
Загрузка ... Loading ...

Очистка базы данных WordPress

Wordpress certainly a great CMS. But it has its downsides. First of all, it involves the use of the database.

Today I'll show you how you can without the help of plug-ins, the most optimized database WP just a couple of clicks. First of all, go to your panel PhpMyAdmin.

Delete backups posts

Problem. WordPress is so arranged that when writing new posts (or edit the old ones) it periodically backs them up. What is, after the publication of the final version of the article, WP does not remove these backups (post revisions). It turns out that in continuous operation with one post in the database may be left from a couple of copies of this post indefinitely.

Decision. PhpMyAdmin panel in its database link to this page SQL. We put in the window line and execute it by pressing OK:

  post_type = "revision" ; DELETE FROM wp_posts WHERE post_type = "revision"; 

Explanation of the code. Wp_posts table has a field post_type. It can have one of the following: «post», «page» or «revision». Since we want to get rid of all the redundant positions, our value - «revision». Just run the command to remove all items in the table wp_posts, in which the field is post_type «revision».

Remove spamnyh comments

Problem. All comments that at least once fell to the blog forever remain in the database. This applies to approved, deleted and spamnyh comments.

Decision. PhpMyAdmin panel in its database link to this page SQL. We put in the window line and execute it by pressing OK:

  comment_approved = 'spam' ; DELETE FROM wp_comments WHERE comment_approved = 'spam'; 

On many blogs there are a large number of generally not considered comments. To remove all of them, run the following command:

  comment_approved = '0' ; DELETE FROM wp_comments WHERE comment_approved = '0 '; 

Explanation of the code. Wp_comments table contains a field named comment_approved. It is here that a notation for each comment: approved - 1, removed or not yet approved - 0 spam - spam. By running these commands one by one, we remove all comments that meet our criteria.

WordPress database row by default

Many plugins are creating their rows (tables) in the database WP and do not remove them after its deactivation. The problem is solved by simply removing these lines manually. And to make it easier to find the extra lines, here's a list of strings that should be in the database by default:

  wp_comments
 wp_links
 wp_options
 wp_postmeta
 wp_posts
 wp_terms
 wp_term_relationships
 wp_term_taxonomy
 wp_usermeta
 wp_users 

Note: Before removing these lines, make sure that the plugin does not already in use.

Last modified: 10/08/2013 at 08:03
Published: Sunday, April 25, 2010 at 19:09
Choose the language:

Comments: 11

Average bar: 4.96 out of 5
  1. TiamatInc
    April 25, 2010 at 20:12

    Is WP deleted comments are not clean from the database? Many times the notice, a copy of the size of the database, which after cleaning the spam comments from its size decreases.

    Reply

  2. Seo
    April 29, 2010 at 23:22

    TiamatInc I agree with you!

    Reply

  3. TiamatInc
    April 29, 2010 at 23:38

    An interesting response to the author's post.

    Reply

  4. Ai Pi Mani
    April 30, 2010 at 16:41

    When I was cleaning the database, there were spamnyh comments, which I removed, but simply stated as "spam." Perhaps this is dependent on the availability Akismeta (I have not installed).

    Reply

  5. TiamatInc
    April 30, 2010 at 16:46

    All right. While they are simply labeled, then remain in the database. I delete them all the time while watching, that's cleaned out.

    Reply

  6. onjee
    May 1, 2010 at 19:05

    http://www.ps-group.ru/ochistka-bazy-dannyx-wordpress/
    Um ... The striking similarity ... This is also your site or not?

    Reply

  7. Poltavtcev
    June 2, 2010 at 00:36

    onjee
    January 2010 at 19:05
    http://www.ps-group.ru/ochistka-bazy-dannyx-wordpress/
    Um ... The striking similarity ... This is also your site or not?

    Apparently so. When you click on the "sea" - throws here ...

    Reply

  8. Ai Pi Mani
    June 2, 2010 at 20:08

    This is one of splogov who steals my content.

    Reply

  9. Vladimir
    July 29, 2010 at 22:50

    Why just stealing, because the article is posted splogov not completely, but only its beginning and then there is a link to continue - on your blog!
    All the rules for copying of articles (except, of course, the author's consent - it did not ask)!
    PS And really so stupid that they can not discern the source web site and splogov?
    The addition of these splogov come to you new visitors, and they increase the reference weight of your blog.
    I'm in something not right? What is wrong?

    Reply

  10. Novel
    October 9, 2011 at 14:02

    Show you how to remove all 200,000 records at once?
    By default, in the control panel can be removed at a time only 20 records. Is there any plug-in that removes all entries in the blog?

    Reply

  11. aaa
    October 14, 2011 at 17:05

    Remove with a direct request via phpmysql for example.

    DROP TABLE wp_posts removes all the posts.

    Khoury sql queries to the database.

    Reply

Have something to say? Do not be silent!


Your comment will appear after being moderated.
Spam and off-topic posts are deleted.

To insert php-code, use the tag:
<pre lang="php"> php-code </ pre>


I'm not a spammer!