If you’ve chosen to host on WordPress, then most of the framework decisions are already made for you. You don’t need to choose the development language, the security framework, and many other things that you would normally have to choose in order to start a site from scratch. But for optimal performance there are still some structural decisions you need to make. These are:
- Deciding on 3rd party caching
- How are you going to optimize your scripts/CSS?
- Will you integrate a CDN?
- How will you go about adding custom code?
3rd Party Caching Decisions
Every WordPress site needs to have caching – that’s a given. There’s no point wasting server resources by regenerating a page every time a visitor requests it. This slows down your site performance. Most of the time, your host will not have in-built caching of pages. NameHero is a notable exception because it uses the LiteSpeed web server. Other web hosts don’t have such features, and you’ll be forced to use a 3rd party plugin to achieve server caching.
So this one is actually easy – if you’re hosting on NameHero, then we’ll take care of caching for you in a much more resource-efficient manner than you could have achieved with a separate plugin. All others will need to use something like W3 Total Cache or WP Rocket.
Optimizing Scripts and CSS
Every WordPress site needs to do the following:
- Defer JS and CSS Loading
- In-line the “critical CSS” for immediate page rendering
In the old days, you would even have to concatenate these scripts. But now it’s better to let the scripts load separately. The two best plugins for this in my opinion, are:
- Autoptimize
- Async JavaScript
These two plugins also work together, so you don’t have to worry about conflicts between them. If Aysnc JavaScript is deferring your JS files, then Autoptimize will automatically respect these settings. I like these two because they have specific jobs and they do them well. They don’t mix in their functionality with other things you don’t need.
CDN Integration
You’ll always hear that you need a CDN for your site’s images, CSS, and JS files. This is true. A CDN helps immensely with page speeds from different parts of the world. However, you have a magic weapon that takes care of your CDN needs automatically, and is completely free to boot! It’s name is Cloudflare.
I’ve done extensive testing on the caching differences between the free Cloudflare plan and other paid services like KeyCDN and BunnyCDN. They all have the same cache retention policies. I prefer BunnyCDN to KeyCDN (by a lot!), and you definitely get more control over the caching options. But the performance is the same.
So either use the built-in integration with Cloudflare via the NameHero cPanel plugin, or even better, change your DNS nameservers to Cloudflare and integrate it that way. Trust me, the performance benefit is real.
Adding Custom Code
One of the most important structural decisions in WordPress is deciding how you’re going to add 3rd party code. A lot of websites will tell you to add it to your theme’s functions.php file. But this is a mistake. It’s far better to separate out the code into a separate plugin. Here’s a NameHero knowledgebase article that teaches you how to create a custom plugin for additional code.
This will ensure that your changes persist even when you switch themes. Or if you’re not using a chile theme, then to ensure that your changes remain even after the child theme is updated. There’s simply no substitute for a separate custom plugin. So this should be one of the first things you do.
Use Specific Rather than General Plugins Wherever You Can
When given a choice to install a smaller plugin for a specific purpose, or using a larger one that merely includes it as an additional functionality, choose the specific one wherever possible. They tend to have less bloat, and get more support from developers. They’re also easier to maintain, and spread the risk out as compared to have a centralized plugin like Jetpack to do everything. Always think about how to make your site more robust!
I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!
Alfonso says
This is a great article, but I have a question. So, you don’t recommend using the SL cache plugin? Is it better to use Autoptimize and Asynch Javascript?
Bhagwad Park says
Presumably you’re referring to the LS LiteSpeed caching plugin? If you have a LiteSpeed server, you should ABSOLUTELY use the caching plugin! It doesn’t count as a “3rd party” solution because it is LiteSpeed that is doing the caching, and not your site.