Make your WordPress site fast
What Tanzahost already does for WordPress speed, from the cache at our door to PHP's code cache, and the steps that make the biggest difference after that.
Updated 17 Oct 20264 min read
A WordPress site on Tanzahost starts with the slow parts already taken care of: its images, styles and scripts are kept at our door near your visitors, everything is compressed, PHP keeps its compiled code in memory, and WordPress's own cron no longer runs during visits. What's left is mostly your pages themselves: plugins, images and how much work each page does. This guide goes through both.
What's already on
| What | What it does |
|---|---|
| The cache at our door | Images, CSS, JavaScript, fonts, audio and video your site allows to be cached are kept in memory at our front door, so a visitor gets them without reaching your site. Up to 8 MB a file and 64 MB a site. |
| Compression | Pages and files are compressed for each visitor's browser, with zstd or gzip. |
| HTTP/2 and HTTP/3 | Browsers fetch many files at once over one connection. |
| PHP's code cache | OPcache is on, with WordPress's recommended settings, so PHP doesn't compile your theme and plugins again on every visit. |
| WordPress's cron | It's switched off inside visits, and a scheduled task runs it every 5 minutes instead, so no visitor waits for it. |
| Your own database | Every site has its own database next to it, not shared with other customers. |
Pages themselves aren't kept at the door: each page is answered by your site, because it may differ for each visitor, like a basket or a logged-in admin. Making pages fast is the steps below.
Step 1: see what the door keeps
Ask for one of your site's files and look for X-Cache. The first time says MISS, the next says HIT, from the door:
curl -s -o /dev/null -D - https://duka.co.tz/wp-includes/css/dashicons.min.css | grep -i x-cacheA file is kept for as long as its own Cache-Control header says, or an hour when it says nothing, and never more than a day. It's never kept when the answer sets a cookie or says private, no-store or no-cache. WordPress adds ?ver= to its files' addresses, so a new version of a theme or plugin gets a new address and visitors see it at once.
Step 2: let browsers keep your files longer
Tell browsers, and our door, they may keep images, styles and scripts for a day. Open the file manager, open .htaccess in the site folder, and add this at the end:
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/webp "access plus 1 day"
ExpiresByType image/avif "access plus 1 day"
ExpiresByType image/jpeg "access plus 1 day"
ExpiresByType image/png "access plus 1 day"
ExpiresByType image/svg+xml "access plus 1 day"
ExpiresByType text/css "access plus 1 day"
ExpiresByType text/javascript "access plus 1 day"
ExpiresByType font/woff2 "access plus 1 day"
</IfModule>Your site's web server reads .htaccess as on any classic host, and this module is on. The file manager keeps the version before each save for 7 days, so one click undoes it.
Step 3: cache your pages
Most of a page's time is PHP and the database building it. A page cache plugin, like WP Super Cache, saves each finished page as a file and serves that to the next visitors, skipping the work. Install it from WordPress's own Plugins screen: your site updates and installs plugins by itself. Logged-in users and baskets still get fresh pages, as the plugin decides.
Step 4: make images smaller
Images are usually most of a page's weight. Upload them at the size they're shown, not straight from a camera, and in WebP or AVIF where you can: WordPress makes the smaller sizes itself. A 4 MB photo shown 800 pixels wide is a slow page on a phone, whatever the hosting.
Step 5: give PHP enough memory, not more
Open the site. Under PHP settings, Memory per request starts at half of the site's memory limit, at least 64 MB. That's enough for most sites. Raise it only when a page fails with "Allowed memory size … exhausted" (the fix). More memory doesn't make a page faster.
The site answers up to 8 requests at the same moment, and further ones wait their turn. So a page that takes 3 seconds holds a place for 3 seconds: steps 3 and 6 are what let many visitors in at once.
Step 6: find the slow plugin
Open the site's numbers in the dashboard: the typical response time shows how long pages take.
Open the project's logs: each visit shows its path, status and time taken. Look for the slow paths.
Try turning plugins off one at a time on a copy of your site, not the real one. Copy to staging makes a copy of the site's files and database for exactly that. See Environments.
Sliders, page builders that load everything on every page, and plugins that call other websites while a page is built are the usual reasons.
Optional: Cloudflare
If your domain is on Cloudflare, you can connect it and keep its proxy on. Then Cloudflare's cache sits in front of ours, for visitors far from your site's location. Choose the location closest to most of your visitors in the first place: distance is the one delay no plugin removes.