Clean & Tidy Up WordPress

There is text that reads"WordPress Maintenance & Security". The are three hands with one holding a screwdriver, another holding a wrench and the third holding a drill. They are all pointing to a WordPress logo.

This post is from our WordPress Beginner Tutorials Series on YouTube.

When you start looking around your WordPress installation your going to see that it came installed with placeholders like a sample post and comment with that sample post. The same applies for a pages and so on. All of these default placeholders should be cleaned out.  It is good to see examples, especially if you are new to WordPress. But they do take up space and clutter up your WordPress instance.

Log into your WordPress Dashboard

Just put /wp-admin or wp-login at the end of your domain. Then enter it into your browser’s address window and hit enter on your keypad.  It’s always a good idea to do a backup before making any changes to your WordPress Installation

Once you are logged in you’ll automatically come to this page. We will talk more about this page in the next video…  Let’s first check out that sample post by clicking on Posts, then All Posts. We will simply trash that sample post. Along with deleting that post we will also remove the comment associated with it.

If you wanted to delete the comment individually,  select the Comment, and under bulk actions click on “move to trash” or if you hover your cursor over the actual comment, you have these options here where you can trash it as well. We’ll just do the deletion of the sample post along with the comment.

We will do the same thing with our sample page. Click on Pages then All Pages, select the page, then “move to trash” click “Apply” and it’s gone.

Next, we will go to themes by clicking on Appearance then Themes. This is where are default themes are installed. Since we’re only going to be able to use one theme at a time, there’s no reason to have all these in here. Some people will have as much as 20 or 30 different themes installed on their site. There is nothing wrong with that but you are adding a lot extra bloat. That bloat will slow everything down, and you definitely do not want that.

I think sticking to two themes installed is the way to go.

Remember, these themes will need to be updated from time to time. The more themes you have, the more updates you will have to do. You will always need one extra theme that you can default too in case your main theme has problems. Sure, you could always download that extra theme just when you need it. But it makes it more convenient having it already in there. Using one of these WordPress default themes as your backup is ideal.They are lightweight and will not use up much space.

Let’s go ahead and delete one of these themes. If you hover your cursor over any of the themes you will see there is no delete option. Just click on a theme and you will see down to the right a button to delete the theme. Click it and now you have cleaned out your themes.  

We will do the same thing with plugins. Click Plugins on the Side Bar. You should see two plugins in here: Hello Dolly and Akismet. We will delete both of them. I have an upcoming video that will go over plugins in detail.  

The last thing we will clean out are some files from our WordPress installation.

To access those files, the easiest way is through your control. I am using Inmotion Hosting and they call it the Account Management Panel, it’s the same thing. Depending on who you have hosting your website they may call it something a little bit different.

Once you login to your account look for cPanel and click on it. This should look familiar from a prior video. Then under Files look for the File Manager and click on it. This will take you to you to your root directory which is the highest level of your files hierarchy. Then click on your root directory.

A database in the cloud being swept by a broom.

Your root directory will most likely be named something like public_html, www or just have your website address on the folder. Look for a file named license.txt. Select it by left clicking then click delete at the top.  Typically before doing anything changes like this we would do a backup first. Since we are just getting things setup that can wait for now.

There is a file called readme.html, go ahead and delete that. The next file we want is wp-config-sample.php, and delete that one as well. Then double click on the wp-admin folder. Look for for the file install-helper.php and install.php and delete both of the them. We have installed WordPress so they are not needed anymore.

Next, we are going to add some code to your wp-config.php file

Look for your wp-config.php file. Left click, then right click and select “edit” to open it up.

Copy the code I have added below:

                                      /* Delete Trash Every 3 Days */

                                          define(‘EMPTY_TRASH_DAYS’, 3);

 

                                      /* Saved Revisions in Seconds */

                                          define(‘AUTOSAVE_INTERVAL’, 120);

 

                                      /* How Many Revisions are Kept */

                                           define(‘WP_POST_REVISIONS’, 5);

I want you to carefully paste that code above the wp debug code in your  wp-config file like so. Just make sure it is above “That’s all, stop editing! Happy blogging.” Any code you may add in the future also need to be above that line.

define(‘WP_DEBUG’, false);

/* That’s all, stop editing! Happy blogging. */

That’s it, make sure you click the save button at the top. You can now close the page.

WordPress makes good use of their post revisions feature. It gives you the ability to undo changes to your posts and pages. This is done by reverting back to the previous version or an autosaved copy. This setting can be disabled or changed.  

The code autosaves in seconds. So, we have it set for 120 seconds which is two minutes. It can be set to whatever time span you want, just change the number.

/* Saved Revisions in Seconds*/

define(‘AUTOSAVE_INTERVAL’, 120);

There may be articles on your site that have several post revisions, depending on how much time you spent on them. By default, it is set for unlimited and that will quickly add bloat to your site. You can limit the number of revisions per post. We have it set for 5 which seems to be a good safe number. Again, you can change that to any number you want.

/* How many revisions are kept */

define(‘WP_POST_REVISIONS’, 5);

Finally,  the code with Empty Trash Days. This controls the number of days before WordPress permanently deletes pages, posts, comments, and attachments from the trash bin. We have it set to 3 to kept it from building up.

define( ‘EMPTY_TRASH_DAYS’, 3 ); // 3 days

There you have it, a little house cleaning with WordPress. Thanks for reading and you can check out our videos on YouTube for more tips. 

Have a Great Day!

Drew & The WebStop.net Crew

Leave a Reply