Making WordPress faster – tips and tricks

Making WordPress faster – tips and tricks

The loading speed of a website is critical today—it affects the user experience, conversion rates, and even Google search rankings. So, how can you speed up your WordPress site? In addition to using quality caching, there are many other often-overlooked factors that can significantly increase your site’s performance. This article provides a detailed checklist for optimizing WordPress.

1. Measuring WordPress Performance

Before you begin optimization, it is essential to analyze your site’s current speed and identify its “bottlenecks.” The following online tools are ideal for this purpose:

  • keycdn Tools 
  • GTmetrix 
  • Google PageSpeed Insights 
  • WebPageTest 
  • Website Speed Test by keycdn

These services not only provide the total load time but also display the number of requests and the overall page size. Using the “waterfall” chart, you can analyze which files and elements take the longest to load and pinpoint where optimization is needed.

I personally use these services regularly:

  • Pingdom: It performs fast, visual tests of the load time for all elements on the page and displays the results in an easy-to-read diagram, highlighting which components load slower than necessary and other problematic areas. 
  • YSlow: A Firefox plugin integrated into Firebug (arguably the best web development tool). It analyzes more than 20 factors that affect site speed, rating overall performance on a scale of 0–100, with each element graded from A to F.

Also, do not forget one important metric that can affect your site’s speed—the number of database queries and the time it takes to execute them. To display this information in your footer, add the following PHP code:

<?php echo get_num_queries(); ?> queries in <?php timer_stop(1); ?> seconds.

2. Checklist: How to Speed Up WordPress

Below are the main recommendations, which typically result in a significant performance boost:

1. Image Compression  

Many WordPress users upload images that are too large, which significantly slows down page load times.  

  • When preparing images for posts, try to create them in the required dimensions from the start and save them in a web-optimized format. 
  • Use online tools such as TinyPNG or compressor.io for better compression. 
  • It is also recommended to use the Imagify plugin to optimize images directly in WordPress. This tool not only compresses images, but it also allows conversion to the WebP format.

2. Lazy Loading of Images (Lazy Load)  

With Lazy Load, images are only downloaded when the visitor scrolls to them. This is especially useful for photo galleries and video-heavy sites.  

  •  While WordPress already has native support for lazy loading, specialized plugins can sometimes provide even better results. 
  •  Many caching plugins, such as WP-Rocket, include a Lazy Load function that can be activated with a single click.

3. Check and Optimize Plugins  

WordPress offers a vast number of plugins, but many of them negatively impact site speed.  

  • Remove any unused plugins to improve both performance and security. 
  • For the remaining plugins, look for lighter alternatives or configure them to load only when necessary.

4. Database Cleanup  

Over time, the database accumulates data—drafts, revisions, spam comments, deleted entries—which slows down query execution.  

  • It is recommended to regularly clean the database using plugins like Advanced Database Cleaner, which helps remove “underbelly” data and optimize tables. 
  • To reduce the number of saved revisions, add the following code to wp-config.php:  

  define('WP_POST_REVISIONS', 3);

5. Reduce the Number of Loaded Fonts  

Web fonts offer excellent typographic possibilities but also add additional server requests, which can slow down your site.  

Limit your site to just a few necessary fonts or use local hosting of fonts to avoid loading them from external servers (e.g., Google), which also complies with DSGVO requirements.

6. Selective Loading of Scripts and Styles  

Many plugins load their JavaScript and CSS files on every page, even when not necessary.  

Use WordPress Conditional Tags to limit loading unnecessary files only to the pages that need them. For example, to disable Contact Form 7 scripts on all pages except the “Contact” page, add the following code to your functions.php:

 

  // Load Contact Form 7 scripts only on the Contact page

  function remove_cf7() {

   if ( ! is_page('kontakt') ) {

    wp_deregister_script('contact-form-7');

    wp_dequeue_style('contact-form-7');

   }

  }

  add_action('wp_enqueue_scripts', 'remove_cf7');

 

If you’d rather not edit the code, try the Asset CleanUp plugin, which scans your site and lets you disable unused scripts and styles on a per-page level.

7. Code Compression  

CSS and JavaScript files often contain unnecessary spaces, line breaks, and comments, which increase file size.  

Use online tools like cssminifier.com or minifier.org to manually compress code, or take advantage of caching plugins that compress code automatically.

8. Use a Caching Plugin  

Caching is one of the most effective ways to speed up WordPress.  

For example, plugins like WP Rocket not only cache pages but also combine and compress CSS and JS files, enable Gzip compression, optimize images, implement lazy script loading, preload the cache, and support CDN integration.  

Additionally, it is recommended to use W3 Total Cache and enable the following options:  

  • Page Cache 
  • Database Cache 
  • Object Cache 
  • Browser Cache  

Note: Do not enable the Minify option as it has failed on 80% of my sites (Minify compresses CSS and scripts). You can choose not to enable it initially, or if you do, test your site (press Ctrl+F5). If the styles remain correct, you can leave it enabled.  

When selecting the caching method, choose the one provided by your server. If unavailable, select Disc:Enhanced.

9. Update Your PHP Version  

If your server is running an outdated PHP version, updating it will bring benefits: security patches, improved compatibility with the latest versions of WordPress, plugins, and themes, as well as overall performance improvements.

10. Hosting  

Choosing the right hosting plan is crucial for your site’s load speed.  

In shared hosting environments where multiple sites share one server, speed may suffer.  

I recommend considering reputable hosting providers such as Timeweb.  

Since WordPress stability and speed depend heavily on database performance, ensure that the settings in your my.cnf file match your server’s capabilities. Recommended settings include:

  – query_cache_type = 1  

  – query_cache_limit = 2M  

  – query_cache_size = 20M  

 A compiler cache improves performance by caching compiled scripts, reducing PHP script execution time. In my experience, using Xcache increases performance by about 5% compared to Eaccelerator.  

Increasing the maximum number of connections in the httpd.conf file (e.g., max_connections = 150) allows the server to handle more connections simultaneously; however, adjust this parameter carefully to avoid exhausting your server’s memory.

11. Use a Content Delivery Network (CDN)  

A CDN hosts static files (images, CSS, JS) on external servers, reducing the load on your main server and speeding up delivery for users worldwide.  

However, if your server is in Germany and your primary audience is German, a CDN may not provide noticeable gains.

12. Additional WordPress Settings  

Beyond the above measures, there are further steps to optimize WordPress itself:

- Disable Hotlinking  

Using your server to store images can lead to excessive resource use if other sites hotlink your images. To disable hotlinking, add the following code to your .htaccess file (replace example.com with your domain name):

  <IfModule mod_rewrite.c>

   RewriteEngine on

   RewriteCond %{HTTP_REFERER} !^$

   RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.com/.*$ [NC]

   RewriteRule .*\.(gif|jpg|png|ico)$ - [F,L]

  </IfModule>

 

 - Use Browser Caching  

Browser caching does not directly speed up your site but reduces server load by caching frequently requested items like styles and scripts. Add the following code to your .htaccess file:

  FileETag MTime Size

  <IfModule mod_expires.c>

   <FilesMatch "\.(jpg|gif|png|css|js)$">

    ExpiresActive on

    ExpiresDefault "access plus 1 year"

   </FilesMatch>

  </IfModule>

 

- Compress Static Data  

Compressing data reduces the size of pages sent to users, decreasing server load and download times. Add the following code to your .htaccess file:

  AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript  

  BrowserMatch ^Mozilla/4 gzip-only-text/html  

  BrowserMatch ^Mozilla/4.0[678] no-gzip  

  BrowserMatch bMSIE !no-gzip !gzip-only-text/html

 

- Disable Post Revisions  

WordPress saves every revision of your posts, which increases the database size and slows it down. To disable post revisions, add the following line to wp-config.php:

  define('WP_POST_REVISIONS', false);

To delete previously saved revisions, execute the following SQL query in PHPMyAdmin:

  DELETE a, b, c  

  FROM wp_posts a  

  LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)  

  LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)  

  WHERE a.post_type = 'revision';

 

- Reduce the Number of Requests  

Eliminate unnecessary HTTP requests to speed up page generation. For example, instead of using the dynamic meta tag:

<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

you can hard-code it as:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

This reduction can save at least two requests.

Final Thoughts

Optimizing WordPress speed is a comprehensive process that includes:

  • Compressing images and using lazy loading 
  • Selecting and configuring plugins, cleaning up the database, and correctly loading fonts 
  • Selectively loading scripts and CSS, compressing code, and using caching 
  • Updating PHP, choosing reliable hosting, and fine-tuning server settings (such as query caching in my.cnf and increasing max_connections) 
  • Additional measures like disabling hotlinking, setting up browser caching, compressing static data, disabling post revisions, and reducing HTTP requests

By implementing all these steps, you can significantly reduce your site’s load time—for example, after my optimizations, my page speed fell to under 1 second, as confirmed by Google PageSpeed Insights tests.

Popular Posts

My most popular posts

Maximum productivity on remote job
Business

Maximum productivity on remote job

I started my own business and intentionally did my best to work from anywhere in the world. Sometimes I sit with my office with a large 27-inch monitor in my apartment in Cheboksary. Sometimes I’m in the office or in some cafe in another city.

Hello! I am Sergey Emelyanov and I am hardworker
Business PHP

Hello! I am Sergey Emelyanov and I am hardworker

I am a programmer. I am an entrepreneur in my heart. I started making money from the age of 11, in the harsh 90s, handing over glassware to a local store and exchanging it for sweets. I earned so much that was enough for various snacks.

Hire Professional CRM developer for $25 per hour

I will make time for your project. Knowledge of Vtiger CRM, SuiteCRM, Laravel, Vue.js, Wordpress. I offer cooperation options that will help you take advantage of external experience, optimize costs and reduce risks. Full transparency of all stages of work and accounting for time costs. Pay only development working hours after accepting the task. Accept PayPal and Payoneer payment systems. How to hire professional developer? Just fill in the form

Telegram
@sergeyem
Telephone
+4915211100235
Email