Clean your WordPress database – .com

Today we will see how to clean our WordPress database, since as time goes by it “fills up” with unnecessary data.

Well yes, databases “accumulate dust”. Or “extra data”, if you prefer. But the idea is that as the days, months and years in which we use WordPress go by, extra data accumulates, which in many cases takes up more than the necessary data. Today it’s time to clean up.

First of all: Backup

Above all: Before touching anything in the database, we have to make a backup copy. In the class I tell you how to do it. And if you want, you can too.

But above all, do not do what I will tell you next If you don’t make that backup first, because if something goes wrong, you will have messed it up a lot.

But… what exactly is the database?

WordPress is made up of two types of data. Files and databases:

  • Records: The WordPress FTP files, the themes, the themes and the files we have uploaded (images, documents, videos, etc.).
  • Data: The content of the website (the texts of the posts, of the pages, the titles of the products, their prices… everything that we “write” and configure).

We do not see that database in our FTP. Although it is normally hosted on the same server, we don’t have it there, visible. We must access with a client program, Sequel Pro style, or an online manager, such as PHPMyAdmin.

And why is it filled with “useless” data?

By default WordPress saves a lot of information, which may be useful initially, but in the long run we may never use it again. For example, the trash, SPAM comments, or even plugin data that we have deleted and no longer use.

See also  Bootstrap 4 Course #7. Forms - .com

WordPress saves all of that as a precaution. Perhaps you are going to want to recover that content from the trash, a SPAM comment that was not SPAM, or even reinstall that plugin that you had deleted.

Okay. How do I clean?

The first thing is to install the plugin. There are many (many, many) database cleaning plugins, but this is the one I recommend, and the one I recommend in the , to which all subscribers have access. The developer is very good, solvent, well recognized and even contributes to the WordPress core. In other words, 100% recommended.

Once installed and activated, we will go to “Tools / Sweep”. And there we will see everything that we can “sweep” in our database. I’m going to go over everything and summarize the most important, so you don’t delete anything you shouldn’t 😉

Post Cleanup

We start with everything related to posts, pages, products and any other personalized content:

The options that allow us to clean are the following:

  • reviews old ones of the posts to be recovered.
  • autosaves of posts that we started writing and left unsaved.
  • Posts in the paper bin that we delete
  • meta information of deleted posts.

We can delete all of this without a problem, unless we are not sure if we are going to want to recover any post from the trash, or if we have autosaves. In other words, as we can see, with that alone we will lower the weight of the database by 27.37%.

Comment Cleanup

Next we move on to the comments. You already know that the content generated in WordPress can have comments from readers. Well, that also leaves quite a bit of “dust”:

See also  Gmail course #2: The inbox - .com

The first row refers to the unapproved comments. Why keep them? same with him SPAMthe comments deletedas well as the orphans, which are comments on a post that has been deleted. Less is more, gentlemen 🙂

User Cleanup

The users are not saved either, since sometimes we have information about them even if we delete them:

This information is “meta-information” of the users that no longer exist, that is, data fields, such as the name, telephone number or twitter account. Since we have deleted them, it does not make much sense to have them there, so it was.

Clean up terms

Terms define relationships between taxonomies (categories, tags, and other custom taxonomies) and the contents (posts, pages, etc.).

Be careful with what we delete here, because as the message indicates, it may be that we have created a taxonomy (for example “Policy”), which is present in scheduled posts, and which is now empty. If that were the case, it would still be deleted.

Cleaning transient options

Now everything gets more technical with the transient options, which are options that are cached for a certain time.

We can delete them without problems, although it may cause some side effect with the users who are viewing the web at that moment, such as their shopping cart being emptied, or being logged out and having to log in again. . That will depend on each plugin.

In any case, it is important to know that this cache of options is constantly being generated as people visit our page, and that they are very useful to avoid unnecessary calls to the database, and to gain speed.

See also  Custom Fields Course #1: Introduction to Advanced Custom Fields - .com

Optimize WordPress database

This is a fixed “yes” as the database tables will be optimized, relocating the information in a more efficient way.

This can also be done from phpMyAdmin, but from here it’s much simpler, just one click on the red button, and you’re all set.

Full database cleanup

Finally, we come to cleaning “to the beast”. That means that we will simply “sweep” or clean all the options indicated above. Or if you are sure (very safe) of what you are doing, this is your button!

And that’s all for today. Just to remind everyone that before using this plugin you must do a backupsince sometimes we do not realize that deleting this data can cause us some unwanted side effect, until it is too late.

As always, you already know that if you want to know more and better, you can, where you have 6045 video tutorials at your disposal (and every day I add more).

That is all for today. See you in the next tutorial. You already know that you can propose any topic for future tutorials in the ! 🙂

Loading Facebook Comments ...
Loading Disqus Comments ...