Finally, your new WordPress site is ready to go.
You load up your home page to bask in its glory, ready to rake in more sales than ever before…only to realize your site takes longer to load than AOL Mail on a dial-up connection.
WordPress is awesome (we use it every day), but one of the downsides of using WordPress—and other open source systems—is that the more features you add in terms of custom code and third-party plug-ins, the longer your load times will be…if you’re not careful.
Luckily, optimizing your WordPress site is a thing, and it can shave precious seconds off your loading speed and increase your WordPress page performance. We’ve done it for all of our clients and you can to!
There are five main reasons why your WordPress site is running slow—let’s go through each one and show you how to fix it for buttery smooth loading speeds and a flawless user experience.
If you hired a developer to piece together your site for you, you probably never took a look at any WordPress page template files. These files are often very complicated, even more so after extensive customization.
If your web host is like most hosting providers, they utilize shared hosting in what’s called a LAMP environment—Linux Apache MySQL PHP. LAMP is a very common software stack that powers most providers’ hosting servers.
We won’t go into too much detail (don’t worry), but in basic terms Apache is what actually serves up files to browsers on your site. However, your page templates are written in PHP…and Apache doesn’t understand PHP, which is a programming language and the foundation of WordPress’ code.
Each time a user accesses your site, those stacks of code in your templates have to be processed. With more users, the workload increases. Apache communicates with PHP using a module that comes standard with every web hosting package.
The module acts as a gatekeeper between what’s stored in the PHP and what’s served to a visitor, and every time a visitor accesses a page on your site they have to go through the same process—Apache sends a request through the PHP module, the module “asks” the PHP code for information, which then generates heaps of HTML, which then gets sent back to the interface module, which FINALLY gets loaded as a full web page.
In theory it shouldn’t take that long, but in practice it can cause a ton of slowdown. Just think of the fraction of a second you have to wait for your brain to tell your muscles to remove your left hand from a hot stove, and imagine if the process took twice as long because your brain was overloaded with third party modules and custom features. Does that make sense? I hope so. It’s the best I could do!
Well, that’s how your site works if you don’t utilize page caching.
With page caching, your PHP code is only accessed every so often, and the resulting HTML is stored in a cache to improve loading times. So the next time Apache needs to serve up a piping hot web page to your visitor, it’s already sitting there, ready to go, without waiting for PHP.
There are tons of plugins available to make caching simple on WordPress sites and probably a billion articles ranking and comparing said plugins. Currently, we use WP Fastest Cache and we like it just fine. Some plugins offer more advanced features and some less, but most of the top-rated plugins will suit your needs.
Page caching takes care of a lot of problems, but not all of them. Even with page caching, some PHP functions will still run every time a page loads. For things like core logic and function definitions, we’ll need to try out object caching.
Object caching simply means storing PHP database objects (variable values) on hard drives or memcaches. The same principle as page caching is at play, where we’re trying to avoid repeatedly running common actions.
As an example, consider WordPress’ user object, which contains first and last name data, among others. Each time a person loads a page on your site, the function powering the user object pulls information from different locations on your database, constructs the user object with that information, and then returns that information.
Instead, we can store that operation’s results on the database as a single object, ready to be served up all at once instead of constructed bit by bit.
The Transients tool built into WordPress allows you to do just that, storing data in WordPress’ database for easy access—even letting you store an entire page’s HTML.
Inefficient is the nice way to say it. Bad code is what commonly happens when you have multiple developers racing towards the same goal in a very short period. If your website was built by adding a handful of additional development goals after completing each previous one, spaghetti code is inevitable.
Even with very talented developers, you still run the risk of winding up with bulky code on your website simply because sites grow far beyond the scope of what we originally think is necessary, and simple functions begin to overlap to the point where we don’t know whether they’re coming or going.
Cleaning up your tangled mess of code should be tackled as a preventive measure rather than all at once through refactoring, which you can make a monthly goal to keep your site loading quickly.
As you continue to add new code and features, working with a sleek, easy-to-understand base is far easier than just dumping more lines on top of your ever-growing spaghetti dinner.
It’s easy to run through WordPress’ plugin search results and download everything that looks cool. While running a ton of plugins isn’t a problem by itself, the issue is that many free plugins aren’t optimized, so the more you download the higher chance you have of running into page speed issues.
By optimized, I mean you’re relying on a third-party plugin to do something that a skilled web developer could do with a fraction of the code.
Each and every plugin your site uses must be loaded with every page. While many of these plugins are high-quality and cache well, some don’t. When browsing plugins, try to avoid the following:
The most affordable hosting plans are probably fine for a personal blog, but for businesses these shared hosting plans just don’t cut it. Shared hosting means your website constantly has to fight for resources with other sites, which you can probably tell can turn into a big problem.
Plus, any hacker who gains access to one site on a shared hosting machine can probably gain access to all the other sites, as well.
As your site and needs grow, you’ll need to think about scaling your server too. Most hosting companies offer easily upgraded tiers of service as your business expands. Also don’t be afraid to invest in additional server-level security—WordPress plugins can only do so much.
If this seems like a lot of work, consider the fact that your site is penalized twice for poor performance—once by Google, and once by customers who leave when pages don’t load quickly.
Even pages that take 5 or 10 seconds to load can cause you to bleed traffic like there’s no tomorrow.
If you need help, check out how we not only create pixel perfect websites but they run lighting fast as well!