Welcome to Centmin Mod Community
Become a Member

WebPerf 18 Tips on How to Speed Up WordPress

Discussion in 'All Internet & Web Performance News' started by eva2000, Aug 17, 2018.

  1. eva2000

    eva2000 Administrator Staff Member

    May 24, 2014
    Brisbane, Australia
    Local Time:
    1:37 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    WordPress is an amazing CMS platform, but it can also be quite slow if not optimized correctly. In this guide, we will show you how to speed up WordPress by sharing our web performance strategies and recommendations.

    Businesses all over the world rely on WordPress to power their websites. It is used by over half of those that use a content management system and according to ManageWP, that is over 74 million websites that are currently using WordPress.

    WordPress is used by 60% of all the websites whose content management system we know. This is 31.6% of all websites. W3Techs
    Source: W3Techs

    Speed Test Tools

    One of the most important tools to use as you work towards speeding up your WordPress site’s speed is a speed test tool. We recommend performing some initial tests before you start making any changes and then performing a subsequent test after every change you’ve made. This will give you a better idea whether something had a positive or negative impact on your site’s speed.

    There are a variety of speed test tools available however KeyCDN offers one that you can test from 16 different locations.


    Additionally, if you need to test a specific asset in multiple locations simultaneously, check out our performance tool which does just that. Our performance test tool provides helpful information including DNS lookup time, Connect times, TTFB, and more.

    Site Speed Matters In 2018

    Now more than ever site speed matters not only for ranking higher in SERPs but also to provide a better user experience and realize higher conversions. Google announced back in 2010 that desktop site speed had an effect on your SERP rank. However, now in 2018, Google has also announced that mobile site speed has an effect on how you’ll rank.

    Therefore, if you want to increase the amount of organic traffic you receive from both desktop and mobile devices, you’ll need to improve your WordPress website’s site speed.

    Apart from ranking higher in the SERPs, if you’re selling stuff online you’ll also see a much higher conversion rate which in turn means more revenue. Take the following example for instance.


    According to Google’s Impact calculator if you take a website from loading in 2.2 seconds to 1.4 seconds and has 200,000 visitors per month, generates an average order value of $50 and has a 3% conversion rate, you could see an increase of over $146,000 in annual revenue.

    That just goes to show how important website speed really is in 2018. So if you’re ready to start optimizing your WordPress website for better performance, read on.

    Speed Up WordPress 2018

    Follow the recommendations below to speed up WordPress and get your site load times down, ensuring the best user experience for your visitors.

    Speed Up WordPress Index

    1. Use a Solid Framework/Theme
    2. Utilize Caching
    3. Implement a Content Delivery Network
    4. Optimize WordPress Database
    5. Optimize Images using Smart Compression
    6. Gzip Compression
    7. Reduce Number of WordPress Plugins
    8. Optimize Web Font Performance
    9. Optimize Font Awesome Icons
    10. Lazy Load Images, Videos, and Disqus
    11. Minify and Concatenate CSS and Javascript
    12. Reduce Misc HTTP Requests
    13. Disable Hotlinking
    14. Disable Pingbacks and Trackbacks
    15. Specify Image Dimensions
    16. Fix The admin-ajax.php Slow Problem
    17. MySQL Tuning
    18. Choose a Reliable Web Host
    1. Use a Solid Framework/Theme

    Behind every WordPress site, there is a theme or framework and along with that can sometimes come bloat. Every theme is coded differently and because of that, there are those that are better than others. The default WordPress themes such as Twenty Fifteen is actually quite fast because it is very lightweight.

    Be careful when purchasing themes on popular marketplaces such as ThemeForest and Creative Market. While there are a lot of great themes on there, you also need to realize that developers sometimes just keep adding features to generate more sales. It is more about finding the right developers. The Total WordPress theme from the devs over at WPExplorer is a great example of a multi-purpose theme that still takes performance into consideration. Even many of their demos, which are packed full of content, load in under 800ms.[​IMG]

    Lightweight frameworks such as the Thesis Theme framework and Genesis also have great reputations for developing fast, well-coded themes.

    2. Utilize Caching

    Caching is another important factor when it comes to speeding up WordPress. Caching stores your pages and posts as static files which are then served to your visitors, reducing the processing load on your server.

    You can utilize caching by using WordPress caching plugins, implementing browser caching, and server-side caching.

    Caching Plugins


    Here are a few free and premium caching plugins:

    Browser Caching – Add Expire Headers to WordPress

    You can also leverage browser caching by adding expire headers. Expire headers tell the browser whether they should request a specific file from the server or whether they should grab it from the browser’s cache. By adding them, it reduces the number of HTTP requests that are needed. Some WordPress caching plugins allow you to add this, but you can also add the code to your .htaccess file.

    <IfModule mod_expires.c>
    # Enable expirations
    ExpiresActive On
    # Default directive
    ExpiresDefault "access plus 1 month"
    # My favicon
    ExpiresByType image/x-icon "access plus 1 year"
    # Images
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType image/jpg "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    # CSS
    ExpiresByType text/css "access plus 1 month"
    # Javascript
    ExpiresByType application/javascript "access plus 1 year"

    Server Caching

    Besides WordPress caching plugins and browser caching you and also take advantage of server-side caching. This is usually done on higher traffic sites. Varnish cache can be very powerful when combined with a caching plugin, and a CDN.

    Prefetch Commonly Used Domains

    Prefetching is similar to caching in the fact that you are telling the browser, like Chrome, to lookup the DNS settings ahead of when they are actually needed. It combs the page and queries any prefetched domains that are not already cached so they load quicker later on.

    You can prefetch domains in WordPress by adding the domain syntax to your header.php file between the <head> </head> tags. This process is non-blocking and will only be performed when possible. Here are some common examples.

    Prefetch Google Fonts:

    <link rel="dns-prefetch" href="//fonts.googleapis.com">
    Prefetch Google Code (jQuery)

    <link rel="dns-prefetch" href="//ajax.googleapis.com">
    Prefetch Google Analytics

    <link rel="dns-prefetch" href="//www.google-analytics.com">

    View a larger list of commonly used domains for prefetching.

    Remove Query Strings from Static Resources

    It can also be beneficial to remove query strings from your static resources as this can cause caching issues with some proxy caches and CDNs. In WordPress, you have a couple options.

    1. Edit your functions.php file to include a function that removes the query strings.
      function _remove_script_version( $src ){
      $parts = explode( '?ver', $src );
      return $parts[0];
      add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
      add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );
    2. If you are using a caching plugin like W3 Total Cache, there might be an option to avoid the creation of query strings.
    3. There are some free WordPress plugins you can also use to remove query strings such as “Query Strings Remover” and “Remove Query Strings From Static Resources.”

    Fortunately, if you are using KeyCDN as your CDN, this is not needed as we have a featured called “Ignore Query Strings” that you can enable within the dashboard. This feature ignores query strings and tells the cache to reply with a cached reply even if the query string differs.


    Read our more in-depth post on removing query strings.

    3. Implement a Content Delivery Network

    It doesn’t matter how big your WordPress install is or how much traffic your site gets, everyone can benefit from implementing a Content Delivery Network (CDN). A CDN essentially takes all of your files (CSS, Javascript, Images) and delivers them on a server closer to the visitor, which decreases the download time. Besides speed, a content delivery network can also greatly affect your visitors experience, your bounce rate, the time they stay on your site, conversions, and even your SEO.

    KeyCDN offers content delivery services via a pay as you go program. To quickly deploy a CDN for your WordPress sites KeyCDN developed a new light-weight plugin called CDN Enabler. It’s freely available and setup can be completed within minutes.


    Load All Assets from WordPress CDN

    Ensure that you load even the smallest of files from your CDN, like your favicon. If you everything is loading from the CDN this creates one single connection. To tweak your favicon simply drop your favicon in the root of your WordPress install via FTP and then add this to your header.php file between the head tags.

    <link rel="shortcut icon" href="https://cdn.domain.com/favicon.ico" type="image/x-icon" />

    You can see from the example in the screen below that 100% of our assets are loading from the CDN.


    Similarly, you can also load your gravatars from a CDN if configured properly. Follow our gravatar CDN guide to learn more.

    4. Optimize WordPress Database

    WordPress has a tendency to start slowing down if you don’t keep your database optimized. There are ways to keep your database clean by disabling and or limiting post revisions, deleting old revisions, and being aware of the 100 page WordPress limitation.

    Disable and Limit WordPress Post Revisions

    WordPress creates a lot of revisions when you are writing. If you aren’t careful you can end up with thousands of unnecessary revisions in your database.


    To fix this problem, you can either disable revisions altogether or limit the number of revisions.

    Disable WordPress Revisions

    To disable WordPress revisions you will need to add the following code to your wp-config.php file. This changes the default autosave interval from 60 seconds to 5 minutes and then disables post revisions. By default, there is still one autosave per post.

    define('AUTOSAVE_INTERVAL', 300); // seconds
    define('WP_POST_REVISIONS', false);

    There is also a great free little plugin called Disable Post Revision which will do the above for you without having to modify any code.

    Limit Number of WordPress Revisions

    To limit WordPress revisions you will need to add the following code to your wp-config.php file. This changes the default autosave interval from 60 seconds to 5 minutes and sets the number of post revisions to three. You can set the number of revisions being stored to whatever number you prefer.

    define('AUTOSAVE_INTERVAL', 300); // seconds
    define('WP_POST_REVISIONS', 3);
    Delete Old WordPress Revisions from your Database

    After you have disabled or limited your post revisions you also will want to clean up and delete old revisions. We recommend temporarily installing the free WordPress plugin WP-Optimize.


    With this plugin, you can clean all post revisions, clean auto draft post, remove spam comments, unapproved comments, transient options, pingbacks, and trackbacks. In the newest version of WP-Optimize, you can also enable auto-cleanup on a predetermined schedule.


    Beware the 100 Page WordPress Limitation

    When laying out the structure for your site you should be aware that WordPress is not meant to handle over 100 pages. You will start running into memory issues and will notice a significant slowdown on the backend. This doesn’t affect the front end speed. WordPress mentions this limitation in their documentation.

    “Note: this parameter was planned for Pages. Be careful, when choosing it for your custom post type – if you are planning to have many entries (say – over 100), you will run into memory issue. With this parameter set to true WordPress will fetch all entries of that particular post type, together with all meta data, on each administration page load for your post type.” Src: Function Reference/register post type

    Pages have a hierarchy tree. So anything to do with a page ends up having to load the entire page hierarchy tree on the backend to distinguish how that page relates to others. When dealing with a post, there is no link to other posts, only the date of the relative post, so you don’t have to load nearly as much. Remember WordPress was originally created as a blogging platform.

    The solution? You should start using custom post types. You can use a free plugin such as Post Type Switcher if you have a lot of pages you want to convert into custom post types.

    5. Optimize Images Using Smart Compression

    As we mentioned in a previous post on smart image compression, on average 56 percent of a website’s page weight is made up of images. So optimizing your images and compressing them down should definitely be high on your priority list. Optimus uses a combination of lossless and lossy compression methods that reduce your file sizes without affecting the visual quality of your images.


    Depending on the image, reductions of up to 70% are possible. You can install the plugin and auto-image your images when uploading them to WordPress.

    6. Gzip/Brotli Compression

    Gzip is another form of compression which compresses web pages, CSS, and javascript at the server level before sending them over to the browser. You can check if your WordPress site is already compressed by using Check GZIP Compression.

    GZIP compression saves 50% to 80% bandwidth and will therefore significantly increase the website’s loading speed. – Check GZIP compression

    You can enable compression by adding the following to your .htaccess file.

    <IfModule mod_deflate.c>
    # Compress HTML, CSS, JavaScript, Text, XML and fonts
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
    AddOutputFilterByType DEFLATE application/x-font
    AddOutputFilterByType DEFLATE application/x-font-opentype
    AddOutputFilterByType DEFLATE application/x-font-otf
    AddOutputFilterByType DEFLATE application/x-font-truetype
    AddOutputFilterByType DEFLATE application/x-font-ttf
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE font/opentype
    AddOutputFilterByType DEFLATE font/otf
    AddOutputFilterByType DEFLATE font/ttf
    AddOutputFilterByType DEFLATE image/svg+xml
    AddOutputFilterByType DEFLATE image/x-icon
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/javascript
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/xml

    # Remove browser bugs (only needed for really old browsers)
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    Header append Vary User-Agent

    You can enable compression by adding the following to your nginx.conf file.

    gzip on;
    gzip_comp_level 2;
    gzip_http_version 1.0;
    gzip_proxied any;
    gzip_min_length 1100;
    gzip_buffers 16 8k;
    gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    gzip_disable "MSIE [1-6].(?!.*SV1)";
    gzip_vary on;

    Additionally, you may want also consider implementing Brotli compression for even further size savings. Brotli is a new compression algorithm developed by Google which has been known to show significantly better results than its predecessor, Gzip. Check out the results below which compare the loading speeds and size differences between a WordPress site that’s Gzipped, compressed with Brotli, and compressed with Brotli + uses a CDN.

    Source: Sitepoint

    If you have Brotli configured on your origin server, you can also deliver Brotli-compressed assets through KeyCDN. This means for all browsers that support Brotli, your Brotli assets will be delivered while all other browsers will receive the fallback Gzip version.

    7. Reduce Number of WordPress Plugins

    A common reason for WordPress slowing down is that people have too many plugins running, creating too much overhead for their webserver to handle. Keeping the number of plugins you have installed to a minimum is very important.

    In the past, there were plugins such as P3 Plugin Performance Profiler and WP Performance Profiler, however, these are either no longer available or are very outdated.

    When auditing your site’s plugins, first check to see when the last time they were updated. If it has been a while, you will see a warning on your WordPress plugin page.


    It is recommended to stay away from these as it is likely they are no longer maintained and could either cause performance or compatibility issues. Additionally, when analyzing the impact on load times, ask yourself if the plugin is something you really need or perhaps you could accomplish the same thing a different way.

    The quality of the plugins you have installed is also an important factor in web performance. Not all plugins are created equal and therefore you should try performing speed tests with a couple of plugins that achieve the same end goal when optimizing for performance. For high-quality WordPress plugins check out Supsystic’s collection.

    8. Optimize Web Font Performance

    As we wrote in our recent case study on analyzing web font performance, 57% of websites are now using custom fonts, which is an 850% increase since 2011. We noted that it is important to serve only the fonts you need, such as WOFF and WOFF2 formats. Services such as Typekit base64 encode all the formats, which can increase download times and slow down your site.

    In our tests, Google fonts performed well because of the use of their CDN and serving only WOFF formats. Open Sans was the fastest of the top 10 most popular fonts. If you are going for pure speed and still want to use Google fonts, the best combination in WordPress would be to use Open Sans and then a web safe font such as Arial.


    It is also important to note the difference between a Google font and a web safe font, as it is almost a 200ms difference. This is primarily due to the download time of the font plus the extra HTTP request to Google’s servers.


    Another option you have is to move your Google Fonts to your CDN. We ran our own comparison between using Google’s CDN and KeyCDN, and it was faster to use KeyCDN. Why? Because it reduces the number of HTTP requests, DNS lookups, lets you take advantage of a single HTTP/2 connection, and have more control over caching.

    WebPageTest Load Time
    WebPageTest Fully Loaded
    Pingdom Load Time

    You can take it one step further by base64 encoding your fonts into a single CSS file and storing them in localStorage. A browser’s native cache gets flushed quite frequently, especially on mobile devices. So by saving to localStorage, the file gets cached persistently. Smashing Magazine avoided a 700ms delay by using localStorage.

    We recommend checking out the localFont tool by Jaime Caballero. You can quickly drag your WOFF fonts into his tool and it will base64 encode them and give you the CSS and Javascript to put on your WordPress site.[​IMG]

    9. Optimize Font Awesome Icons

    When it comes to Font Awesome, you can take advantage of your own CDN to help accelerate its delivery. If your theme already includes Font Awesome you might need to tweak your theme for the following to work.

    Host Font Awesome On Your Own CDN

    Hosting Font Awesome from on own CDN will load from the same connection as your other assets resulting in one less DNS lookup. And if you are running over HTTPS and are on a HTTP/2 supported CDN server then it is better to consolidate your requests to one single H2 connection.

    The first thing you need to do is ensure that your Font Awesome file is loaded relative to your initial CSS path. With this method, as long as your Font Awesome CSS file is being loaded from the CDN, so will the font file. Here is an example as used on our page.


    The link to your Font Awesome file using the CDN URL should look similar to the <link> snippet displayed below.

    <link href="https://cdn.keycdn.com/css/font-awesome-4.4.0.min.css" rel="stylesheet">

    And that’s it, now you have super fast loading Font Awesome icons!

    10. Lazy Load Images, Videos, and Disqus

    Lazy loading is a concept where you delay the loading of the object unit the point where it is needed. In WordPress, this usually refers to not loading the object until a user scrolls down the page or using an on-click event. You can lazy load all sorts of content, from images to videos and even the Disqus commenting system.

    Lazy Load Images

    To lazy load images, there is a great free little plugin called BJ Lazy Load. This plugin replaces all your post images, post thumbnails, gravatar images and content iframes with a placeholder and loads the content as it gets close to enter the browser window when the visitor scrolls the page. Also works with text widgets. If you are using the WP Rocket caching plugin, it also has an option to lazy load images.

    Lazy Load Videos

    To lazy load your videos there is a free plugin called Lazy Load for Videos. It replaces embedded Youtube and Vimeo videos with a clickable preview image. If your website is video heavy this plugin alone can dramatically speed up WordPress.

    After set up page load time went from 3.5 to 1.5 seconds and I couldn’t be happier. – James (Crowd Convergence)
    Lazy Load Disqus


    Disqus is a great commenting system and can be a great deterrent to spam, as it cuts out nearly 99% of it. However, the default Disqus plugin creates 10+ HTTP requests which can drastically slow down your site. Thankfully James Joel developed a plugin, Disqus Conditional Load, which cuts out all these HTTP requests upon initial load. It is also is now SEO friendly, meaning Google will still crawl your comments. We even use this plugin our blog!

    11. Minify and Concatenate CSS and Javascript

    When it comes to speeding up WordPress, minification and concatenation can play a big role.


    Minification of resources means removing unnecessary characters from your HTML, Javascript, and CSS that are not required to load, such as:

    • White space characters
    • New line characters
    • Comments
    • Block delimiters

    This speeds up your load times as it reduces the amount of code that has to be requested from the server.


    Concatenation is the process of combining your CSS and Javascript files into one file for the sole purpose of reducing your HTTP requests. Sometimes this can increase the download time of your file, but it usually outweighs having additional requests. Depending upon the site parallel downloads might actually be faster so it is good to test your site to see which delivers a better result.

    You can use WordPress plugins to minify and concatenate your code. In WP Rocket, for example, there is an option under the basic tab.


    Most WordPress caching plugins now have these options, but there are also other free lightweight plugins that you can use such as Better WordPress Minify and Autoptimize. Also when it comes to placing CSS and Javascript in WordPress it is always best practice to move the CSS to the top and the Javascript to the bottom.

    Note: If you want to enhance your Autoptimize plugin’s configuration or run a full site speed optimization, check out Autoptimize’s pro services.

    12. Reduce Misc HTTP Requests

    Decreasing the number of HTTP requests that WordPress makes is very important. Follow these instructions on how to fix the gravatar problem and the additional request to load emoji’s since WordPress 4.2


    If you are using the native WordPress commenting system by default it creates a separate HTTP request for each gravatar. If you have a lot of comments this can result in tons of requests and unnecessary redirects as seen in the example below.


    There are a couple of options you have to get around this.

    Option 1 – Disable User Gravatars

    The first option is to simply disable user gravatars and use only local avatars. This is not ideal, but how important is WordPress speed to you?

    To do this install the free WordPress plugin WP User Avatar. This In the settings menu click on “Disable Gravatar and use only local avatars.” Then choose a default avatar.


    Option 2 – Disqus is Faster

    Your second option is to use lazy load Disqus as we mentioned earlier. Yes, this seems strange because adding a javascript file, plugin, and an external call normally would mean additional load time. But if you compare this to a blog post with 5 or more comments than Disqus is actually faster because of the reduced number of HTTP requests.

    Disable Emojis

    With the release of WordPress 4.2 came updates for additional emoji support. Unfortunately what this means is that they are now including an additional javascript file wp-emoji-release.min.js?ver=4.3.1 in your header. This creates an unnecessary additional HTTP request, especially if you don’t want to even use them.


    Follow the instructions below to disable emoji’s and get rid of that additional HTTP request.

    First under “Writing Settings” in WordPress make sure you uncheck the “convert emoticons” option under formatting. Then follow the rest of the steps below.


    Option 1 – WordPress Plugin

    Install the free WordPress plugin “Disable Emojis” by Ryan Hellyer. This plugin disables the new emoji functionality in WordPress 4.2.

    Option 2 – WordPress Function

    If you don’t want the overhead of another plugin then simply take the code from Ryan’s plugin and drop it into the bottom of your functions.php file.

    1. /**
      * Disable the emoji's
      function disable_emojis() {
      remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
      remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
      remove_action( 'wp_print_styles', 'print_emoji_styles' );
      remove_action( 'admin_print_styles', 'print_emoji_styles' );
      remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
      remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
      remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
      add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' );
      add_action( 'init', 'disable_emojis' );

      * Filter function used to remove the tinymce emoji plugin.
      * @param array $plugins
      * @return array Difference betwen the two arrays
      function disable_emojis_tinymce( $plugins ) {
      if ( is_array( $plugins ) ) {
      return array_diff( $plugins, array( 'wpemoji' ) );
      } else {
      return array();
    Disable Scripts on a Page-level Basis

    Normally you want to get rid of plugins, but there is a plugin called Gonzalez which actually lets you disable unnecessary scripts from loading on a page-level and site-wide basis. It isn’t free, but well for the money if you are trying to squeeze out a little more speed. For example, Contact Form 7 is a great form plugin for WordPress, but by default it loads its script on every single page. With this plugin, you can easily disable it and only load it on your contact page. Then repeat with your social sharing plugin, etc. You will most likely be able to get rid of at least 5 or more HTTP requests/scripts by using this plugin.


    Disable Embeds

    Since WordPress 4.4, there is a new script that is loaded, wp-embed.min.js which allows you to more easily embed videos, images, tweets, etc. For example, WordPress will automatically turn the URL into a YouTube embed and provide a live preview in the visual editor. A lot of people don’t use this feature or might not need it. You can always link the original way by grabbing the embed code off of YouTube or Twitter. The big issue with this feature is that is loads the script on every page. There are a couple of ways to disable this script.

    Option 1 – WordPress Plugin

    Install the free WordPress plugin “Disable Embeds” by Pascal Birchler. This plugin does the following:

    • Prevents others from embedding your site.
    • Prevents you from embedding other non-whitelisted sites.
    • Disables all JavaScript related to the feature.
    Option 2 – WordPress Function

    Or you can drop the following into the bottom of your functions.php file to also disable embeds.

    // Remove WP embed script
    function speed_stop_loading_wp_embed() {
    if (!is_admin()) {
    add_action('init', 'speed_stop_loading_wp_embed');
    Disable Comments

    Whenever you are using threaded comments in WordPress the comment-reply.min.js script is included on every post and page. There might be times when you don’t need this script. Maybe you don’t allow comments on your site or you use a 3rd party commenting system like Disqus. In those cases, there is no need for this script to load on every page.


    To disable this script you can drop the following code into the bottom of your functions.php file.

    // Remove comment-reply.min.js from footer
    function comments_clean_header_hook(){
    wp_deregister_script( 'comment-reply' );
    13. Disable Hotlinking

    Hotlinking refers to someone directly linking to one of your images on their own server. What this means is that when someone visits their site it has to load the image from your server, taking up your bandwidth. You can disable hotlinking by adding the following code to your .htaccess file and updating it with your domain name.

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC]
    RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]

    You can also add hotlink protection to your KeyCDN account by creating a zone referrer. This will prevent people from embedding your CDN assets.

    After implementing hotlinking, images on external sites will show up as broken, a 403 error in the header.

    Example of broken image on external site

    14. Disable Pingbacks and Trackbacks

    Pingbacks and trackbacks are considered by some as a legacy feature now, and they can cause slowness when it comes to page speed. With Ahrefs, Google alerts, and other brand monitoring tools now available, there are much better ways to see if someone has linked to your content.

    You can disable pingbacks and trackbacks under the discussion settings in WordPress. Note: this only applies to new posts.


    To disable pingbacks on older posts you can use the bulk edit post feature and change pings to “Do Not Allow.”

    15. Specify Image Dimensions


    Most of you have probably seen the following Google Pagespeed recommendation at one point:

    Optimization suggestion: “By compressing and adjusting the size of … you can save 5.8 KB (51%).”

    This recommendation refers to your images being scaled down by the browser. For example, maybe the image you upload has a 500px width, but the column it was placed in is only 400px wide. This results in your image being scaled down to 400px due to CSS so that it matches the column size. This can be a problem in a lot of WordPress themes because developers tend to scale things down in responsive themes using CSS.

    It is better to always upload images into WordPress at scale. This sometimes means cropping them with Photoshop, Paint, or Gimp before you upload them. This saves resources and also will keep you compliant with Google Pagespeed’s guidelines. Or you can also upload multiple resolutions of your images and serve the right resolution for the right device.

    16. Fix The admin-ajax.php Slow Problem

    In WordPress 3.6 the WordPress Heartbeat API was introduced, which allows WordPress to communicate between the web-browser and the server. This improved upon session management, revision tracking, and auto-saving.

    The WordPress Heartbeat API uses admin-ajax.php to run AJAX calls from the web-browser. You have probably seen this when running speed tests. This can cause high CPU usage and a lot of PHP calls. For example, if you leave your dashboard open it will keep sending POST requests to this file on a regular interval.

    There is a free WordPress plugin called heartbeat control which allows you to easily manage the frequency of the WordPress heartbeat API.


    Note: there are a lot of 3rd party developers now using this file. If you notice delays, it is possible it is being caused entirely by a plugin polling admin-ajax.php. To dig into this, you can run your site through a speed test tool, locate the admin-ajax.php call and open the post data.


    You can then usually tell by the “action” name what plugin is polling it. In this example, it was “get_shares_count” which turned out to be a social plugin that didn’t have caching enabled. Once caching was turned on, the admin-ajax.php polling stopped.


    Hopefully that helps you understand a bit more about how to troubleshoot admin-ajax.php slow issues.

    17. MySQL Tuning

    Optimizing MySQL is also very important. Unfortunately this is very specific to your environment and your setup so we can’t provide recommended configurations. The MySQL/MariaDB configuration file is normally located in /etc/my.cnf. Here are a few settings though to keep an eye on.

    • tmp_table_size
    • query_cache_type
    • query_cache_size
    • query_cache_size
    • join_buffer_size
    • max_heap_table_size

    A highly recommended tool is the MySQL Tuner script. It is read-only and won’t make configuration changes. It will give you an overview of your server’s performance and make some basic recommendations about improvements that you can make after it completes. Here are a couple other tools you can use as well:

    18. Choose a Reliable Web Host

    And of course, last but not least, choosing a reliable and fast web host can be one of the most important decisions you will make when trying to figure out how to speed up WordPress. We recommend staying away from cheap shared hosting as they tend to overcrowd their servers and you will end up sharing resources between hundreds of people. The old saying, “You get what you pay for,” definitely applies here. We suggest going with a VPS or managed WordPress host depending upon your level of expertise and time.

    Digital Ocean is a great cloud VPS provider and you can get started running WordPress for as little as $5/month. They feature SSDs, 1Gbps network, a dedicated IP address, and you can easily scale up or down in a matter of seconds. They now even feature a 1-click installer for WordPress. It’s recommended that you have some web hosting knowledge with Digital Ocean as they are not a managed host, meaning if you get hacked, it is your responsibility to fix it.

    Linode is also another good choice if you are looking for a cloud VPS. They have plans starting at $10/month and all feature SSDs, API, CLI, and easy scaling across 8 datacenters in 3 different regions.

    Vultr is slightly newer to the VPS game, but they provide very fast and stable servers throughout their 14 different locations. A newer feature they now offer is DDoS mitigation service.

    Managed WordPress Hosting

    For those less tech savvy a managed WordPress host might be a better solution. Yes, you will pay more, but depending on the size of your business and how important your time is, the price sometimes outweighs the cost. With a managed WordPress, they will help you when issues arise such as a slow website, your site gets hacked, downtime, installing SSL certs, etc.

    Here are some popular high-performance managed WordPress hosts:

    Here are some great additional tips from Hosting Facts on how to speed up your website without changing hosts.

    Speed Up WordPress – In Summary

    Hopefully, this post has helped you learn more about how to speed up WordPress and the many options available to you. From choosing a good host to optimizing the database, implementing a CDN, compressing your images, cleaning up your code, and reducing the number of HTTP requests.

    We would love to hear from you below if you have other strategies we might not have mentioned.

    Related Articles

    The post 18 Tips on How to Speed Up WordPress appeared first on KeyCDN Blog.

    Continue reading...
    Last edited: Aug 17, 2018
  2. Jessica Ervin

    Jessica Ervin New Member

    May 30, 2020
    Dallas, TX
    Local Time:
    8:37 AM
    1.10. x
    MariaDB 10
    There's no doubt in that the speed of your website is cornerstone of user experience. If your site's page loads more than three seconds then your visitor might move on and you could lose a chance to convert & probably they wouldn't come next time. Thus, no WordPress website owner can afford to ignore website speed. Here's the guide on best WordPress speed test tools which you can use to identify your website speed for Better Website Performance.
  3. DerGelbe

    DerGelbe New Member

    Jan 13, 2017
    Local Time:
    11:37 AM
  4. eva2000

    eva2000 Administrator Staff Member

    May 24, 2014
    Brisbane, Australia
    Local Time:
    1:37 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Yeah forum image proxy might not like remote images of specific kind or the original article blocked them or changed images - the above is from RSS feed imported articles and original is at 18 Tips on How to Speed up WordPress - KeyCDN which is linked at bottom of above post too.

    edit: yup looks like KeyCDN changes their blog's URL and image URLs hence broken images