Skip to content
BeoHosting
BeoHosting
WordPress

How to Optimize WordPress for Speed

BeoHosting Team··10 min read read
How to Optimize WordPress for Speed

Why does WordPress site speed matter?

Site speed directly affects user experience, SEO rankings, and conversions. Google uses Core Web Vitals (LCP, FID, CLS) as ranking factors, and research shows that 53% of mobile visitors abandon a site that takes more than 3 seconds to load. Every additional second of delay reduces conversions by about 7%. For WordPress sites, which power over 43% of the internet, speed optimization is critical for success.

The good news is that most WordPress sites can be dramatically sped up with the right settings and plugins - often without any coding. In this guide we cover every aspect of optimization, from server to front-end.

1. Caching plugins

Caching is the most effective single optimization for WordPress. Instead of the server generating the page from the database on every visit, the cached version is served directly - which is dramatically faster.

LiteSpeed Cache

If your hosting uses the LiteSpeed Web Server (like BeoHosting WordPress hosting), LiteSpeed Cache is the best choice. It is free and runs at the server level, which makes it faster than plugins running at the PHP level.

  • Page Cache: Enable it and set TTL (Time to Live) to 604800 (7 days) for static pages.
  • Browser Cache: Enable it to cache static files in visitors' browsers.
  • Object Cache: Enable if the server supports Memcached or Redis for caching database queries.
  • CSS/JS Optimization: Minification, combining, and async loading of CSS and JavaScript files.
  • Image Optimization: Built-in image optimization with WebP conversion.

WP Super Cache

A simple and reliable caching plugin from Automattic (creators of WordPress). Ideal for beginners with minimal settings. It generates static HTML files and serves them instead of dynamic PHP pages.

W3 Total Cache

The most complex caching plugin with the most options. It supports page cache, database cache, object cache, browser cache, minification, and CDN integration. Requires more technical knowledge for optimal setup, but delivers the best results for advanced users.

2. Image optimization

Images are typically the largest resources on a web page - often 50-80% of total size. Image optimization can dramatically reduce load times.

Image formats

  • WebP: A modern format that is 25-35% smaller than JPEG at the same quality. Supported by all modern browsers.
  • AVIF: An even newer format that is 20% smaller than WebP, but browser support is still limited.
  • JPEG: Still good for photos. Use quality 80-85% for the best size/quality balance.
  • PNG: Use only for images that require transparency. Otherwise too large for photos.
  • SVG: Ideal for icons, logos, and simple illustrations - scales without quality loss.

Image optimization plugins

  • ShortPixel: Automatically compresses images on upload. Offers lossy, glossy, and lossless compression. Free for up to 100 images per month.
  • Imagify: From the creators of WP Rocket. Automatic compression with WebP conversion. Free for 25MB per month.
  • Smush: A popular free plugin with bulk compression. The Pro version offers larger limits and advanced options.
  • EWWW Image Optimizer: Can compress locally on the server (does not send images to an external service).

Image dimensions

Always upload images at the dimensions in which they will be displayed. No need to upload a 4000x3000 image if it will display at 800x600. WordPress automatically creates multiple sizes (thumbnail, medium, large, full), but the original still occupies server space.

3. Database cleanup

The WordPress database accumulates unnecessary data over time that slows queries. Regular cleanup can significantly speed up the site.

What to clean

  • Post revisions: WordPress saves every revision of every post. A site with 100 posts can have 1,000+ revisions. Limit to 3-5 revisions by adding the WP_POST_REVISIONS constant to wp-config.php.
  • Spam and trashed comments: Comments in trash and spam still occupy database space.
  • Transients: Temporary data plugins cache in the database. Expired transients are not deleted automatically.
  • Auto-draft posts: WordPress autosaves drafts while writing. Old auto-drafts accumulate.
  • Unused meta data: Removed plugins often leave meta data in the database.

Database cleanup plugins

  • WP-Optimize: Cleans the database, compresses tables, and can schedule automatic cleanup. Free and reliable.
  • Advanced Database Cleaner: A more detailed tool that also identifies tables left over from removed plugins.
  • WP-Sweep: A simple plugin to clean revisions, drafts, spam comments, and other unnecessary data.

4. CDN (Content Delivery Network)

A CDN distributes your site's static files (images, CSS, JS, fonts) to servers around the world. Visitors load files from the closest server, which reduces latency and speeds up loading.

Popular CDN services

  • Cloudflare: A free plan with CDN, DDoS protection, and SSL. Easiest to set up - just change nameservers.
  • BunnyCDN: Affordable price ($0.01/GB), great performance, and easy WordPress integration.
  • KeyCDN: Pay-as-you-go, no monthly fee. Good for sites with variable traffic.
  • Cloudflare APO: Specialized for WordPress - caches the entire page at the edge, not just static files. $5/month.

Integrating a CDN with WordPress

Most caching plugins have built-in CDN integration. In LiteSpeed Cache, go to the CDN section, enable CDN, and enter the CDN URL. The plugin will automatically replace static file URLs with CDN versions.

5. Lazy loading

Lazy loading defers loading of images and iframes that are not visible on screen. Instead of the browser loading all images at once, it loads them only when the user scrolls to them. This dramatically speeds up the initial page load.

Native lazy loading

Since WordPress 5.5, native lazy loading is built in. WordPress automatically adds loading="lazy" to images and iframes. This is supported in all modern browsers and requires no plugins.

Advanced lazy loading

For more control, use a plugin like a3 Lazy Load or WP Rocket that offer: lazy loading for background images (CSS background-image), lazy loading for video embeds (YouTube, Vimeo), placeholder images or a blur effect while the image loads, and disabling lazy loading for specific images (e.g. a hero image that should load immediately).

6. Additional optimizations

Reduce the number of plugins

Every plugin adds PHP code, CSS, and JavaScript loaded on every page. Review installed plugins and remove any you do not actively use. For features you need on only one page, consider conditional loading via Asset CleanUp or Perfmatters.

Use the latest PHP

PHP 8.4 is significantly faster than older versions. Benchmarks show PHP 8.4 is up to 3x faster than PHP 7.0 for WordPress. In cPanel, you can change the PHP version in the "MultiPHP Manager" or "Select PHP Version" section.

Optimize fonts

  • Host fonts locally: Instead of loading from Google Fonts servers, host fonts on your own server. The OMGF plugin automates this.
  • Use font-display: swap: Shows text immediately with a fallback font while the custom font loads.
  • Limit font variants: Load only the weights you actually use (e.g. 400 and 700, not all 9).
  • Use WOFF2: The most efficient web font format, supported in all modern browsers.

Preload critical resources

Use link rel="preload" for resources critical to initial page rendering: hero image, main font, critical CSS. This tells the browser to start downloading these resources as soon as possible instead of waiting for the parser to discover them in the HTML.

Measuring results

Use these tools to measure speed before and after optimization:

  • Google PageSpeed Insights: Provides Core Web Vitals scores and concrete improvement recommendations.
  • GTmetrix: Detailed analysis with a waterfall view of all requests, sizes, and load times.
  • WebPageTest: An advanced tool that can test from different locations and devices.
  • Chrome DevTools (Lighthouse): Built into Chrome - right click, Inspect, Lighthouse tab.

Conclusion

Optimizing a WordPress site for speed is a process, not a one-time action. Start with caching and image optimization, as they deliver the biggest impact with the least effort. Then add a CDN, clean the database, and implement lazy loading. Regularly measure speed and monitor Core Web Vitals in Google Search Console. A fast site means happy visitors, better SEO rankings, and more conversions - investment in speed always pays off. Check your site's performance with our site speed test.

BeoHosting Team

10+ years of experience — Web hosting and infrastructure specialists

  • Web Hosting
  • WordPress Hosting
  • VPS
  • Dedicated Serveri
  • Domeni
  • SSL
  • cPanel
  • LiteSpeed
  • Linux administracija
  • DNS

Last updated: