Do you want to speed up your WordPress website? Follow this tutorial to improve your website speed and serve to more site visitors.
WordPress is an easy to use CMS for creating websites. It can be extended to different websites like e-commerce shops or social networks with the help of powerful plugins. Ability to add different functionalities and features is the beauty of WordPress software.
At the same time content added to your website will grow over time and your website will feel slower than it was before. Website content, server software, plugins are the main reasons for slow WordPress websites.
Now let’s learn why you need to keep your website fast for users and SEO. Then I will explain how to easily optimize your website for speed.
Table of Contents
Why should you speed up WordPress website?
When we analyze our own experience for browsing the web we can clearly see that website speed is very important for our satisfaction. Sometimes when you search the web and visit a website from search results it takes more than average to load a page. Then you go back to search results and click on other websites from there. When that page loads faster you read it and complete your interaction. You probably will read from that website in future and recommend it to your friends.
Why we behave like this. Because sometimes it is faster to return back to search results and load other faster websites from there. So we are preferring faster websites over slow ones. This behavior is also noticed by search engines and over time faster websites will rank higher and slow ones will be displayed in lower positions or disappear from the first page of search results.
This means with a fast website we satisfy our visitors and google will show our website in higher positions to satisfy those visitors.
Research done by Google which is published in Deloitte report “Milliseconds Make Millions” shows how page load time effects user focus that leads to leaving your website.
|Time to Load||User Impact|
|0 to 16ms||Users are exceptionally good at tracking motion, and they dislike it when animations aren’t smooth. They perceive animations as smooth so long as 60 new frames are rendered every second. That’s 16ms per frame, including the time it takes for the browser to paint the new frame to the screen, leaving an app about 10ms to produce a frame.|
|0 to 100ms||Respond to user actions within this time window and users feel like the result is immediate. Any longer, and the connection between action and reaction is broken.|
|100 to 300ms||Users experience a slight perceptible delay.|
|300 to 1000ms||Within this window, things feel part of a natural and continuous progression of tasks. For most users on the web, loading pages or changing views represents a task|
|1000ms or more||Beyond 1000 milliseconds (1 second), users lose focus on the task they are performing.|
|10000ms or more||Beyond 10000 milliseconds (10 seconds), users are frustrated and are likely to abandon tasks. They may or may not come back later.|
To help website owners with site performance Google has developed tools for measuring page load speed and perception speed. Website speed report and its rank is available in google search console. When your website does not meet certain speed requirements it will show as error and warning so that you can speed up those WordPress pages.
To summarize, we need a faster WordPress website to satisfy site visitors, get more visitors and rank higher in search engine results.
How to speed up WordPress website
There are multiple ways to speed up your WordPress website. When applied individually it will improve speed a little. To increase speed dramatically apply as much as possible from these instructions.
If your website is already loading faster than 1 second for all visitors then their instructions can improve your speed a little. But if your website loads slower than 3 seconds then these instructions will make your website load in less than 1 second.
Check WordPress website speed
Before starting to improve our website speed we need to know the current loading speed of the website. We cannot improve something that cannot be measured.
For measuring performance of WordPress website we will use 2 free tools.
Tool 1: Info plugin for WordPress
WordPress website is dynamic. It uses data from the database and creates a web page every time when a page is requested. A lot of processing is done to generate and serve every WordPress page.
Info plugin for WordPress will show how long it takes to generate a page. Additionally it shows how many database queries are made and how much ram used for it.
WordPress page generation time information is shown in 2 places:
- Admin bar for logged in users.
- Inside source code for all users. Source code can be viewed with
Ctrl+Ukey combination. This is more accurate page generation time because it is calculated after most of the page content generated.
Our goal is to keep page generation time as low as possible, ideally lower than 0.2 seconds. But generally load time lower than 1 second will be fine.
Page generation time will increase depending on web hosting speed, number of installed plugins, poorly coded plugins, theme or widgets, too many active visitors, too big databases with more than 10k posts etc.
Speed optimizations will be discussed in next steps. For now we need this plugin to monitor page load time while we optimize our WordPress website.
By the way this plugin is tiny and does not use any database storage. It just shows already available data to users without much calculations. So you can keep this plugin and check your website generation speed always.
Tool 2: Search console & Page speed tool by Google
Google has a free tool for website owners known as Search Console. It has all SEO information about your website. Including website indexing, search query rankings (known as keywords), page speed metrics, incoming links from external websites etc. Follow these instructions to add your website to Google Search Console.
After adding your website to the search console it will start populating it with information about your website.
We will use 2 features of google search console regarding website performance (speed):
Metric #1: Page Experience & Core Web Vitals
Report will show which pages need to be improved and what is slowing down those pages. Report is automatically generated using data from real users and from search engine bots. You will always have live recent information about your website and see improvement when you fix reported issues.
Each page speed is evaluated using the PageSpeed Insights tool by Google. If that is not enough you can always try other website speed testing tools.
Page experience report can be viewed by clicking “Page Experience” from the menu in Search Console.
Metric #2: Server response time
Server response time is time taken to generate your WordPress Page and send it to the user device. It is also known as Time To First Byte (TTFB). This is a more precise metric because it evaluates server speed of your web hosting. You can dramatically reduce server response time by using caching plugins. Which we will discuss below.
Server response time can be viewed by:
- Click on “Settings” menu in Search Console
- On the opened page click on “Open Report” for the “Crawl stats” item.
- On the opened page, find the “By file type” section and click on the “HTML” row. Because HTML is dynamically generated in WordPress.
- On the opened page click on the “Average response time (ms)” tab above the chart. This will show you how long it takes to load dynamic pages on WordPress.
This shows your server response time for generating dynamic WordPress pages. Load time data is recorded when google crawlers read your pages for indexing.
Keep an eye on average server response time and try to keep it below 300 ms on average.
Update server software, WordPress plugins & theme
Technology is evolving so is server software. Every new version of server software, PHP, MySQL, WordPress, plugins and themes gets a bit faster. Always keep your software up to date in order to get maximum performance.
When you login to WordPress it checks for updates and shows you all available updates with information related to each update. WordPress also checks for installed PHP versions and informs you if it is too old and needs to be updated.
Screenshot from benchmark results done by Kinsta hosting running WordPress on different versions of PHP from 7.2 to 8.1.
WordPress running on PHP 8.1 can handle 50% more requests compared to PHP 7.2.
Remove unused plugins
Plugins are the beauty of WordPress website. They add extra functionality like ecommerce, form submission, email marketing, membership features etc. At the same time every new functionality will require additional processing and storage on your server. This will naturally slow down your WordPress website.
To keep your site as fast as possible do not install unnecessary plugins that do not add real value to your website. Try to keep the total number of installed plugins below 10.
Always look for ways to reduce plugin usage in WordPress. Check these 5 ways to reduce plugin usage that helped us to decrease memory by 61% and increase page speed by 45%. When possible prefer using WordPress core features or static widgets instead of plugins.
Generally slow plugins use remote API, use too many database records or just poorly coded plugins. After installing plugin check your WordPress website performance using tools mentioned in step 1.
Always uninstall not used plugins and do not leave them as deactivated. Because WordPress will regularly check all installed plugins for updates. When you uninstall the plugin all its files will be deleted and some of them will remove related database records which are no longer required. This will free up your server and database.
Remove unnecessary widgets and page elements
Widgets add extra information to your website sidebars and the footer. Having too many widgets will destruct visitors from the main purpose of the page and will slow down page generation speed of WordPress. Because each widget means additional database queries and server processing.
Some known slow widgets are:
- RSS feeds, instagram, twitter, news etc. They use remote requests which are very slow.
- Related posts widgets calculate post relation using heavy database calculations.
You can speed up slow widgets by using built in caching into those widgets or use separate widget caching plugin.
Disable pingback and trackback feature of WordPress
Pingback and trackback are old features which are misused over time by spammers. So they are not used by real people any more. It is good to disable those features so WordPress will not slow down processing unnecessary requests.
To disable pingback and trackbacks navigate to “Settings”→ “Discussion” page in WordPress and make sure to uncheck related checkboxes. Save changes after making changes.
Use fast WordPress theme
Speed of each WordPress theme varies as well. One of the main criteria when choosing a theme should be its speed. Theme speed is also important for users on mobile devices as well.
Use the fastest theme for your WordPress site because it will increase user experience and SEO of your website. I have suggested some fast WordPress themes in mobile SEO article.
Optimize image file size
Images are taking a big portion of a webpage by its file size. Couple images may take up to 90% of all resource by file size. Minimize file size for images by using image dimension no bigger than page size. For example, generally the image dimension for a web page should be no bigger than 800 pixels.
Correct file format for images is also important for minimizing its file size. Use JPG for photos, PNG for vector images and for screenshots with text.
Reduce image size before uploading to WordPress website. If you already have some big images on your website then optimize their size with plugins.
Detailed steps for choosing the right image format, image dimensions and resizing plugins can be found in Image SEO tips for WordPress article. You can also remove unnecessary image sizes from WordPress in that article. Which will eliminate excess server processing and unnecessary storage for those image sizes.
Use lazy loading for images
WordPress introduces native lazy loading for images starting from version 5.5. Update your WordPress to the latest version in order to take advantage of lazy image loading. It will load only images visible to the user view after loading all text on the page.
Lazy loading will load only necessary images depending on visible portion of the web page. If you have a long article with 20 images it will load only a couple images initially and load the rest of the images as users scroll down the page. Delaying load time for not visible images will show information on WordPress pages much faster. It will also save server bandwidth if the user will not scroll down to read the full article.
Embed videos instead of hosting them
Videos are great for explaining topics but they take lots of server space and not optimized for each device. Do not upload videos to your WordPress website. Instead use external services like youtube for your videos and embed them to your WordPress pages. Youtube will optimize and deliver videos much faster than your own server. Additionally you will have increase chances to reach your customers by appearing in multiple platforms.
Your videos will be searchable in youtube and you can link to your article from youtube description to drive interested visitors to your article. Linking from youtube will help with SEO as well.
Compressing by minification and merging can be done with the Fast Velocity Minify plugin for WordPress. You can also try alternatives if; it does not work well with your WordPress installation. Alternatives for merging and minifying .js and .css files are: Merge Minify Refresh, Autoptimize.
In most cases using async (asynchronous) loading methods for scripts will work perfectly for WordPress sites without breaking your regular page functionality.
Keep external script dependency at minimum
Most external scripts also can be delayed until user interaction. So they will load only when really needed.
Speed up with WordPress caching plugins
WordPress works by generating every web page dynamically. Page generation takes time depending on database size, theme and plugins. You can reduce this time by using caching plugins that save the whole page in cache. Next time when the same page is requested, the caching plugin will load that page from page eliminating all time taking calculations. Your web page will be served extremely fast.
When regular dynamic page generation takes 2 seconds, the cached page will be ready in 0.1 second. In other words your website can serve 200 cached pages instead of generating a single page dynamically.
Do you wonder how much speed improvement caching will make? Check this screenshot of WordPress page load time with and without caching plugin.
WordPress website loads 15x faster with caching plugin.
Do you really want to make your website load fast?
There are popular caching plugins with different features. I use “Docket Cache” for object caching and “Super Page Cache for Cloudflare” for serving cached pages directly from Cloudflare servers. “Cache Enabler” is also a good caching plugin for caching the whole page if you are not using Cloudflare servers.
View comparison of best WordPress caching plugins (including those mentioned above) and choose fastest solution suitable for your website.
Use widget caching
Widgets are part of dynamic pages that can take some time to generate. Generally widgets for loading RSS feeds, news, popular posts, related posts take a long time to generate. You can use caching for widgets and populate those slow widgets faster.
Caching widgets is a wise solution because most widgets are used across the whole WordPress website and load on every page. For example, the same widget will load on all posts, articles, home page etc. When widget generation takes 1 second all your pages will be slower for 1 second. When you use a cached widget it will load in a couple milliseconds on all pages from cache. This will speed up all pages on your WordPress website.
There is a simple caching plugin for widgets Widget Output Cache. I use it to cache all slow widgets on my website.
Use browser caching
Browser caching is a smart way of telling a user browser that the content of the page will not be updated in a certain time. So next time when a visitor visits the same page it will load a stored copy of the page from the user device. This will also reduce load to our server because most pages will not be loaded over and over again.
Browser cache enabled in Super Page Cache for Cloudflare and load time shown in chrome web developer tools using F12 key.
Most page caching plugins have a feature enabling browser cache. You can set cache time depending on site activity. For busy sites which post lots of new posts and comments regularly, cache time can be a couple minutes. For websites where new posts are added every week or so you can set cache time in hours or days.
Optimize WordPress database
WordPress uses a database to store all its content. It includes pages, posts, widgets, users etc. When the database grows and gets bigger, the website starts to slow down. Reading and writing data to big databases is always slow.
You can clean your WordPress database by deleting old revision and autosave information from it. Use WP-Sweep plugin to clean up old unused data from the database.
Also some deleted plugins will leave some unused database tables. To find unused tables and delete them using Plugins Garbage Collector (Database Cleanup) plugin for WordPress.
Depending on your website functionality you may get lots of inactive users who have not posted any content on your website. These are generally profiles for forum plugins like bbPress , membership plugins like BuddyPress, other user registrations for commenting. You can delete those ghost accounts using the Delete Spam Users plugin.
Avoid chained redirects
Running an active website means regularly creating and modifying content. Over time your website will have content that is no longer actual. That old, not relevant content is usually deleted to keep your website up to date. To keep SEO value of those deleted pages and showing related content to visitors coming to those pages it is good to redirect them using 301 method. When you have multiple redirects some of them can get multiple redirects until the user reaches the final page. Every redirect adds a little time until the final page loads. Try to avoid chained redirects so relevant pages will load much faster.
Screenshot from Rank Math SEO plugin.
If you are already using the Rank Math SEO plugin (read my review) it also has 404 page monitoring and page redirection features. Alternatively use a dedicated plugin called Redirection to manage 404 pages and redirects.
To host and serve all static files for your website you can use the free Cloudflare service. Once registered and activated your website will load faster. Cloudflare regularly adds new technologies to their services like HTTP3, brotli compression etc. Your website will always be fast and secure with cloudflare services.
Use CDN for caching WordPress website completely
Hosting static content with CDN is good but what about dynamic WordPress pages. Can you imagine how fast it will be to serve all your pages from CDN. It will be fast and your server will not be overloaded. Actually serving whole pages from CDN will make your website hosted on a shared hosting process super fast as it is a dedicated server.
To serve all WordPress pages with Cloudflare CDN use Super Page Cache for Cloudflare plugin. You will notice a speed boost when viewing your website. Your visitors will thank you for the fast website.
Page cache with using Cloudflare servers will allow to deliver cloud level speed even on shared hosting. This is lifehack to use free cloud service and cheap shared hosting and compete with expensive cloud WordPress hosting providers.
Reduce file size with GZIP
Most popular web hosts offer content compression for faster page delivery. Web pages can be reduced 90% from 100 kb to 10 kb. This means your web page feels faster and loads faster. This is very important for mobile users because download size is noticeable for mobile networks.
Prevent hotlinking files from your server
File hotlinking means when your images are directly used on other websites. They will use your resources when your image is loaded on their website. This is not fair practice and will reduce performance of your server when not prevented. You can prevent file hotlinking with custom directives for apache or nginx servers.
Lazy load and paginate WordPress comments
Comments on WordPress can grow over time. It can reach a couple hundred comments for some popular posts. Loading that much content on a single page will slow down page generation and increase page size. Which will result in slow page load time. To prevent such slow down paginate comments or use plugins to lazy load comments.
Split comments to 50 or 20 per page and paginate it using the built -in WordPress feature. Navigate to “Settings” → “Discussion” page in WordPress admin area. Comment pagination is built in feature of WordPress so you do not need any plugin for using it. Pages with few comments load faster. Paginating comments will speed up your WordPress page loads.
Best solution will be lazy loading because your main content is more important and comments will load later without slowing your website. Use Lazy Load for Comments plugin for wordpress. After installing and activating plugin settings can be found in WordPress “Settings” → “Discussion” page. There you can choose to load comments “On Scroll” or “On Click”.
Lazy loading comments will speed up WordPress pages by:
- Reduce processing time while generating pages.
- Reduce page size so less data to download.
- Decrease page load and rendering time.
- Comments will not be loaded for most bot requests. This frees up server processing resources for real users.
Do not use full post content in blog homepage and category pages
Content blogs have long articles with more than 2k words each. Imagine what happens if you load full content in your homepage or in a category page of 10 articles. Your page will be at least 20k words. It will be a huge page which will eventually load slow. So prefer using short snippets in category listing pages and on the home page if you are using a blog page as your home.
Using short post snippets (excerpts) will also prevent you from duplicate content confusion. Because having full post content in other pages is not good practice.
Excerpt length can be configured using theme features. I am using Neve theme on my blog. Settings shown in screenshot can be found in “Appearance” → “Customize” → “Layout” → “Blog/Archive” page. You can set excerpt length from there. You can also completely disable excerpts and show only featured images and post titles if you want. There is also list, covers or grid layout options available from there. You are viewing list layout in screenshot.
Reduce post revisions
When you update your post WordPress saves its copy as a revision and stores it in the database. This is done to allow you to switch back to the old version of your article if you made some mistakes or accidentally deleted big portions of important information from your post. It is a good feature that will secure your article edits.
With every revision your database will get bigger and a bit slower. To prevent your database to fill up with too old revisions you can limit the number of automatic revisions in WordPress using following code in your
wp-config.php (file is located in the root folder of your WordPress installation).
define( 'WP_POST_REVISIONS', 4 );
This code will limit the number of revisions to 4. You can also set it to 0 to disable revisions completely but it is not recommended. It is always safe to have a couple revisions so you can recover your posts after an accident.
Optimize background process times and frequency
WordPress core or some plugins perform regular operations like cron jobs, backup, cache cleanup, update checks, loading plugin news, addons, some plugin promotions and other heavy calculations. These operations are time and resource consuming. Try to schedule those regular tasks to times when your website has few visitors during the day. It is usually night time or close to the morning. You can find time with few visitors using google analytics.
There are 2 types of background processes that can slow down your website:
Remote HTTP requests
WordPress uses WP_HTTP Requests to get information about core/plugin/theme updates in background. This will dramatically slow down your website. Page generation time may reach up to 10 seconds in some cases.
Page will wait until remote content from other web server received. Every remote HTTP request will add at least a second to your page generation time. When you have 3 remote requests on page then your page will slow down for 3 seconds on top of regular page generation. This slowdown is not acceptable.
Block remote HTTP requests on slow pages and set lower timeout using HTTP Requests Manager plugin. “Smart Block” operation mode will prevent WordPress from slowing down.
Scheduled Cron jobs
Other background process responsible for slow pages in WordPress is Scheduled Cron Jobs. Cron job performs regular tasks like publishing scheduled posts, cleaning up cache, updating database, scanning files etc. Use cron job logging plugins to detect slow processes and find responsible plugins. Then change plugin settings to avoid any slow cron jobs or use remote cron job processing.
Protect from brute force attacks
WordPress admin is protected by login page. Users with bad intention can try to login by guessing username and password. Login guessing is done using a huge database of passwords. It is known as brute force login attack. Malicious software will try to login thousands of times with different passwords until it finds the correct one and logs in.
For each login attempt even for not successful one WordPress uses server resources and will slow down your website for other pageviews. Your server even can crash as a result of multiple (more than hundreds simultaneous) login attempts.
To prevent breaking your WordPress website from brute force attacks and prevent slow down by multiple unsuccessful requests use login security plugins for WordPress. Most of them will block the ip address of a maliciously acting user and block it from accessing the login page.
Protect from spam
Spam is bad for SEO which is also the reason for slow page load times. Because spam comments use your database and fill it up with useless data. All that spam data is loaded with your posts which makes unnecessary calls to the database. After getting that data from the database it will be loaded with the page making your pages bigger than they would be. This all adds up and makes your website load very slow.
Imagine a post having 2k words and spam comments having 10k words as spam. It will be a huge page with 90% spam which will load slow because of spam.
Viewing spam comments will give a bad impression to your visitors as well. This means your website is not maintained. Your visitors will be annoyed and will not visit your website in the future.
Enable manual comment moderation if you get few comments. Always use anti-spam plugins to prevent automated comment submission by bots.
Use fast website hosting
Web hosting is responsible for server response time. Your hosting should generate WordPress pages fast. For this it needs to use the latest server software and hardware. Latest versions of PHP, MySQL, server side caching features, fast SSD disks, fast network, some sort of DDOS protection.
Depending on your pageview counts you may need to move from shared hosting to dedicated or cloud servers. Server requirement for each website varies so check these WordPress hosting providers for best website speed.
Why is my WordPress site so slow?
WordPress can be slow due to several reasons. Using unoptimized plugins, having too many dynamic widgets, having old server software, not optimized database, not optimized theme, not using caching, not optimized images and other static assets. Having too many visitors on shared hosting is also another possible reason for having a slow WordPress website. To find exact reason why your website slow you need to measure server response time and measure asset delivery optimization using web vitals explained in the first step.
How do I speed up WordPress without plugins?
How do I make WordPress faster?
Caching is the main solution to speed up any website with heavy traffic. It will handle up to 90% of all requests to your website. Even on shared hosting you can optimize your WordPress with caching plugins or external services like Cloudflare and serve your visitors like you are on a more expensive hosting solution.
Remember that every plugin and widget that is not adding real value to your website needs to be removed. This way you will keep your WordPress clean and fast.
Keeping your WordPress site clean and fast is a regular task. Even well known plugins can be sold and new owners may add features that can slow down your WordPress website. When you regularly measure your website speed and keep an eye on search console reports related to web vitals you can detect changes to your website and fix reasons that slow down your website.
WordPress is cool software but you need to take care of its optimization when using it. Think about optimization before you upload images, when adding new plugins and widgets. You need to understand what affects website speed and how you can use WordPress so it stays fast.
In this article we explained many optimization steps to WordPress. Each step explains the source of website slow down and solutions to speed it up. Try to understand why each optimization step is used and how you can use your site to prevent slow downs in the future.
Using these steps you can feel speed difference instantly. Remember to measure speed change after each optimization.
Fast website means more happy visitors and clients. Website speed is also one of SEO ranking factors. Learn more ways to optimize your website for search engines.