cPanelResources

Tutorial Basic WordPress Optimization Steps

Overview
Wordpress is a very flexible platform that allows for many plugins or customizations to be used so that every website is unique. However, the time that it takes to load your website can influence how successful it can be.

We find that many of our users are concerned with page load time as a result of concerns that visitors may go to another site with the same information and better performance. In this guide, we will go through and share some of the most common things that are done to help optimize your WordPress installations.

Please keep in mind that cPanel Technical Support is unable to assist with the optimization of WordPress sites. We recommend you contact a Qualified System Administrator if further assistance is required.

The Basics
Sometimes, the basics are the best place to start your investigations or optimizations to make sure that all of your bases are covered. This section will cover some of the more commonly missed things.

1) Make sure your WordPress is fully updated

The main issue that we see with WordPress installations is that they are not kept on the most recent version. This can result in missed updates that may be needed in the event significant bugs are found in the WordPress functions.

cPanel & WHM includes an Automatic Updates feature as part of WordPress Manager. We recommend taking advantage of this feature by using WordPress Manager to manage new or existing WordPress sites on your cPanel account. You can learn how to use WordPress Manager on the link below:

WordPress Manager - cPanel Knowledge Base - cPanel Documentation

For WordPress installations managed outside of WordPress Manager, you can quickly check for an update with your WordPress Installation by logging into your wp-admin page and then going to Dashboard >> Update. If you would like to enable automatic updates, WordPress now has this option available to be set in the wp-config.php since version 3.7.

To set up the automatic updates, you can add the following line through into the wp-config.php in the WordPress installation:

Code:
define( 'WP_AUTO_UPDATE_CORE', minor );
This will allow WordPress to update for each minor version that is released for each installation. However, if you would like WordPress to also automatically update for each major version you can change the code above from minor to true. Please keep in mind though that this may cause errors or downtime with your WordPress installation as these updates can include major changes to the CMS.

While there is a code to auto-update the theme and plugins for your WordPress installation, it would be recommended to have these settings updated by a developer in case of any issues.

To add in the code for updating themes on your WordPress installation, you can use the following in your wp-config.php:

Code:
add_filter( 'auto_update_theme', '__return_true' );
To enable auto-updating plugins on your WordPress installation, you can use the following code in your wp-config.php:

Code:
add_filter( 'auto_update_plugin', '__return_true' );
2) Check how many plugins are installed

One thing that seems to be commonly overlooked is the number of plugins that are installed onto the WordPress installation. The best way to see the number of plugins would be in your wp-admin in the Plugins >> List Plugins page. From there make sure that the All button on the top is clicked on so you can see all plugins.

While the plugins are set to disable on this page, they will still increase the content that is read by your installation and can increase load time. This is because most plugins will write information to the site's database which then has to be filtered when WordPress loads its web pages.

3) Check your trash can and empty as needed

As of WordPress 2.9, a trash system much like the recycle bin on your normal home systems was introduced. Whenever you delete something such as a comment or post, it goes into this trash system. This can take up a lot of unnecessary room on your website's database since your comments and posts are stored there.

If you would like to manually review the trash data, you will need to review multiple locations as there is a unique trash icon for each type of data:
  • Blog Posts >> Trashed
  • Pages >> Trash
  • Comments Page
If you would like to auto delete the items after a few days, you can add this line to the site's wp-config.php file. For example, the following code will autodelete the items in the trash system after seven days:

Code:
 define ('EMPTY_TRASH_DAYS', 7);
If you would like to disable the trash system completely, you can use this line in your wp-config.php file instead. This will make it so that any deletions are removed from the database immediately:

Code:
 define ('EMPTY_TRASH_DAYS', 0);
4) Enable Gzip Compression

One way to help get the information from your website to your clients would be through the use of GZip Compression.

There is not a way to enable GZip through the WordPress installation directly, however, you can add in the following code to the bottom of the sites .htaccess file (/home/username/public_html/.htaccess if WordPress is installed in the default document root):

Code:
<IfModule mod_deflate.c>
# Insert filters
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-httpd-fastphp
AddOutputFilterByType DEFLATE image/svg+xml

# Drop problematic browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>

5) Install a Caching Plugin

Normally having a Caching plugin may help reduce page load with your WordPress installation. However, make sure that you read the reviews as some caching plugins may cause some more issues then they help for optimizing your website. Some caching plugins will also help you with other recommended improvements, such as the GZip options and the browser caching mentioned in our advanced steps.

The most common plugins that we see in use are the W3 Total Cache and WP Super Cache. Both of these can be installed through the wp-admin interface using the "Plugin >> Add Plugins" page. Many hosting providers recommend the WP Super Cache plugin. This plugin is simple and easy-to-manage as it has fewer options to learn and configure. The other option, W3 Total Cache, is a more advanced plugin that has many features and settings available. If this is not set up properly, it can cause more performance issues than improvements. This is recommended for advanced users or if you want to use a CDN for your site.

6) Turn off Tracebacks and Pings

In some cases, some other websites will create pages and articles but link the pictures back to your server to help save resources on their behalf. This can create a traceback or pingback for your site which uses your server and database resources. In some cases, this can slow down your server if it gets too many requests coming in at once.

Unless this is absolutely needed it is normally a good idea to disable these options that allow for tracebacks and pingback. You can find the settings for these in your Discussion Settings located at 'WP-Admin >> Settings >> Discussion:

Screen Shot 2018-12-07 at 12.41.12 AM.png


Additional Steps
If you have completed all of the steps listed on this page we highly recommend checking out our Advanced WordPress Optimization Steps.

In some cases, the server load may be higher than normal and may not be tied directly to the WordPress installation. In those cases, we would highly recommend checking out our guide on troubleshooting high server loads.

Additional Questions/Feedback
Feel free to click on the Discussion tab to let us know if you have any questions or feedback about the information in this tutorial.
Author
cPanelResources
Views
155
First release
Last update