How I Optimized a WordPress Site to Load in Under 2 Seconds

1. GTmetrix / PageSpeed Insights Scores Before & After

To measure the impact of the optimizations, I used GTmetrix and Google PageSpeed Insights to analyze the site’s performance before and after the changes.

Before Optimization:

  • GTmetrix:
    • Page Load Time: 6.5 seconds
    • Performance Score: C (70%)
    • Fully Loaded Time: 8.2 seconds
    • Total Page Size: 3.5 MB
    • Requests: 85
  • PageSpeed Insights:
    • Mobile Score: 45/100
    • Desktop Score: 60/100

After Optimization:

  • GTmetrix:
    • Page Load Time: 1.8 seconds
    • Performance Score: A (90%)
    • Fully Loaded Time: 2.5 seconds
    • Total Page Size: 1.2 MB
    • Requests: 45
  • PageSpeed Insights:
    • Mobile Score: 85/100
    • Desktop Score: 90/100

2. Hosting & CDN Used

Hosting:

I switched to a managed WordPress hosting provider known for its speed and reliability. The new host offered optimized server configurations specifically for WordPress, which significantly improved performance.

CDN:

I implemented a Content Delivery Network (CDN) to distribute static assets (images, CSS, JavaScript) across multiple servers worldwide. This reduced latency by serving content from the nearest server to the user. I chose Cloudflare for its ease of integration and robust features.

3. Plugin Optimization

I reviewed the installed plugins and made the following adjustments:

  • Deactivated Unused Plugins: Removed any plugins that were not actively being used to reduce overhead.
  • Replaced Heavy Plugins: Switched to lightweight alternatives for essential functionalities. For example, I replaced a bulky page builder with a more efficient one that still met design needs.
  • Caching Plugin: Installed and configured a caching plugin (WP Rocket) to enable page caching, browser caching, and minification of CSS and JavaScript files.

4. Image Compression and Lazy Loading

Image Compression:

I used an image optimization plugin (Smush) to compress images without losing quality. This reduced the overall page size significantly.

Lazy Loading:

Implemented lazy loading for images and videos, which means that media files are only loaded when they come into the viewport. This drastically reduced initial load times and improved user experience.

5. Database Cleanup

To further enhance performance, I performed a thorough cleanup of the WordPress database:

  • Removed Unused Data: Deleted post revisions, spam comments, and trashed items that were no longer needed.
  • Optimized Database Tables: Used a plugin (WP-Optimize) to optimize database tables, which improved query performance.
  • Scheduled Cleanups: Set up regular database cleanups to maintain optimal performance over time.

Leave a Reply

Your email address will not be published. Required fields are marked *

Select the fields to be shown. Others will be hidden. Drag and drop to rearrange the order.
  • Image
  • SKU
  • Rating
  • Price
  • Stock
  • Availability
  • Add to cart
  • Description
  • Content
  • Weight
  • Dimensions
  • Additional information
Click outside to hide the comparison bar
Compare