![The best ways to keep track of a WordPress database](http://mijncdnpartner.nl/dynamic/Blog/Wordpress-standaard-cover.jpg)
The best ways to keep track of a WordPress database
A WordPress database is the heart of your website, it contains all the changes, pages, blog posts and much more. As your website grows, so will your database and with it your Hosting. Here is how best to keep it up to date.
In this article we use some technical terms that are also explained earlier in our blog posts and in our knowledge base. Jump to the different topics in this blog post with the following table:
First, let's recap the WordPress database.
A database of WordPress is maintained in a MySQL database, these databases are included in almost all packages of MijnHostingPartner.nl. In this database you can use PHPmyAdmin to perform most actions. The rest goes through the customer panel or the control panel. When you have installed your WordPress website or will install it via the Web app gallery in the control panel, a MySQL database is automatically created for you.
In this database, the various user accounts, posts, pages and revisions are stored.Besides your settings for the website and many other things. Even comments or posts made on your website. And so on. You can imagine that as your website gets bigger and older it can grow exponentially. This can impact a lot of things. One of those things is the speed of your WordPress website, an important item. In this blog post we will explain how you can best keep track of it and where necessary limit it so that the database remains clear and duplicate and useless data is removed.
Limit WordPress post revisions
For every post you create on a WordPress website, a large number of revisions are often kept so you can always go back to an earlier point in time or fix a mistake. This is a useful item and is used fairly often depending on your writing style. What is noticed is that for most writers soon for a blog post of 800 words over 7 revisions are stored. This is often more than necessary. Over time this accumulates and there can be hundreds or thousands of revisions stored in the WordPress database. Revisions is one of the main reasons why a WordPress database can quickly become filled with duplicate and unnecessary content.
So the best way to limit this is with a small tweak in the wp-config.php file.For the starters reading this do this right away rather than in a few months!
The adjustment can be made in the wp-config.php file which is located in the wwwroot in the hosting space. The next adjustment is then to be made on or around line 71. (Depending on your settings).
Under the line:
$table_prefix = 'wp_';Is to place the following: define( 'WP_POST_REVISIONS', 3 );
This limits the number of post revisions to 3.This number can also be changed to any number you want.In many cases, 3 is just right.
For any post made in the future, these changes are now in place. But how do you do this for all older posts? You can do this through PHPmyAdmin, however you will have to write a MySQL query that will check every post and then remove it. Only do this if you have longer experience with this.The easy way is to install a plugin called WP-Optimize.This plugin takes the work out of your hands. This plugin is free to use, it only has a premium edition. It does however remove all old post revisions.
Keep track of comments and clean up SPAM
Comments on a WordPress website are mainly SPAM comments or people hunting for backlinks for SEO purposes. For a large website it can be almost a day's work to keep track of this. For people just starting out it can be a mere 5 minutes a month to keep up. SPAM comments can also be tracked in a number of ways. With your own blacklist in the standard WordPress function or with the well-known plugin Akismet.
The plugin is free to use, however you need to create an account and you have to accept the fact that every comment is also stored in a third place. Namely on the servers of Akismet. And besides that it is yet another plugin that needs to be installed. SPAM comments that are flagged by WordPress are by default retained in the database for 30 days. With a popular website this can quickly add up.
We recommend you to take a look at your website. Certain niches suffer more than others. Of course you can also choose to disable comments or posts altogether. The best way to prevent SPAM!
Use the built-in WordPress database optimization tool
Once in a while it is also an idea to check the WordPress database with the WordPress tool. With this tool two actions can be performed. The latter can be chosen for this article.
For this action is also to return to the wp-config.php file and add the following line also under the same place.
define( 'WP_ALLOW_REPAIR', true );
This rule activates the repair mode. After this you can go to the following URL in the browser. https://jouwDomeinNaamHier.nl/wp-admin/maint/repair.php and choose the option Repair and optimize Database. An extensive cleaning will start.
Set a limit on the number of plugins
Already briefly mentioned above but also put a limit on the number of plugins you install. Too many plugins on a WordPress website is not only discouraged by us, but also by a lot of other well-known figures in the WordPress world. Too many plugins not only means more entries in the database than necessary, but also more things that need to be maintained and more opportunities for malicious people to crawl in and take over the website.
Therefore it is important not to install a plugin for every action you take. For a table of contents like in the beginning of this article or quick jump guide a plugin is often installed as well. While this is an easy piece of HTML code that can be copied just like that. So take a critical look at every plugin you have installed. And remove them if you don't use them. Just deactivating them is not enough.
As always backups, backups and more backups!
Backups are easy to make with the control panel of MijnHostingPartner.nl and without much work to maintain.Save yourself a lot of headache and set up a weekly, monthly or daily backup for your website and database.