What WordPress loads without you needing it
PerformanceYou have cleared out your plugins.
9 min read
By Timo Wessels Published
You have cleared out plugins. The images are smaller. The fonts are on your own server. And the page is still heavier than it needs to be.
Then it is worth looking at a layer that hardly anyone looks at: what WordPress itself delivers. Not your theme, not your plugins, but the core. It brings files and header lines that exist for functions many websites never use.
That is no fault of WordPress. It is a system that does not know what you plan and therefore provides everything at first. What of it is really needed can only be decided by someone who knows the site.
The most important points first:
- Never switch everything off at once. Flip each switch on its own and look at the page afterwards.
- Always check logged out, in a private window.
- Note down what you switched off.
Why it matters
Every file a page loads is a request of its own. The browser has to ask for it, wait, receive and process it. One small file goes unnoticed. Twelve do not, especially on the phone, where every connection is more expensive than at the desk.
A second effect comes on top: some things keep running in the background while the visitor reads, and regularly ask the server for new data.
And third, there are entries in the head of the page that load nothing but only give something away, such as which interfaces are open or which version is running. They cost no load time but are ballast anyway.
Three groups, three questions
I do not see this as one list but as three groups with one test question each (my grouping):
- Functions you do not use. Question: does this occur on my website? If not, it can go.
- Things only the administration needs. Question: does a visitor see this at all?
- Things loaded everywhere but needed in one place. Question: does this have to be on every page? Here you rarely switch off completely but narrow down.
Group one: functions you do not use
Emoji support. The WordPress core outputs a small script on pages to detect emoji (the function is called print_emoji_detection_script). It makes sure emoji look the same in older browsers. Modern browsers can do that themselves. If no emoji occur on your page, and on most business pages they do not, you are loading something that does nothing.
The embed function. WordPress can embed foreign content when you insert the address. The WordPress guide names examples like YouTube and Vimeo. It brings its own script for that. Whoever uses no embeds loads it anyway. That is how I experience it.
Links to services nobody uses any more. In the head of a standard WordPress page stand entries for long-discontinued blogging tools, a link to an editor from the 2000s, a discovery link for services that no longer exist, a short link that hardly anyone opens. They cost no load time but stand there for no reason.
The comment function if you have no comments. If comments are switched off, the page does not need to load anything for them either.
Self-links on publishing. If you link to one of your own pages in a post, WordPress by default reports that to itself. That makes work on every publication and helps nobody.
Foreign profile pictures. WordPress by default uses Gravatar, an external service, for the pictures beside comments. That is a connection to a foreign server on every view of a page with such a picture, with everything that means for data protection. There is an article of its own on what loads before consent.
Group two: things only the administration needs
The icon font of the back end. WordPress brings its own font for the icons in the administration area. By my observation it is delivered on many sites to anonymous visitors too, who never see the administration area. That is a whole font file for icons nobody sees.
The background connection (Heartbeat). According to the WordPress handbook a timer runs in the browser that sends data to the server every 15 to 120 seconds and waits for an answer. It is there so that nothing is lost while you write and so that you are warned if someone edits the same post. In the administration area that is useful. On a public page that is only read, it creates, in my assessment, requests with no purpose.
Switching it off completely is the wrong move. Whoever removes the connection everywhere loses the automatic saving while writing. The right way is to leave it out in the public area and keep it in the administration area, or to slow its rhythm.
The password strength meter. A comparatively large script that checks how secure a typed password is. It is needed at registration and reset. In my experience it is often delivered everywhere.
The old compatibility layer for JavaScript. A helper file that keeps outdated code running. If theme and plugins are current, nobody needs it. That is my experience.
Group three: loaded everywhere, needed in one place
The styling of the blocks. By default WordPress loads the styling of all block types, including those that do not occur on the page. The filter should_load_separate_core_block_assets changes that. According to the reference, WordPress then loads the styling of blocks only when they are needed on the page. The default is “false”, so everything is loaded, even if it is not needed. On pages with few blocks that saves a lot in my experience.
The theme’s central design settings. Block themes generate a set of design variables from their configuration file and deliver it on every page. This can be switched off, but only if another system supplies these variables completely. Otherwise the page lacks its basic values, and the design breaks.
This is the one point in this article where I advise caution. Visible design hangs on it, not only invisible ballast.
The trap: it always looks good for you
Whoever is logged in often sees the website in a different state from an anonymous visitor. Some optimisations deliberately do not apply to logged-in users. That is right, but it means that when you look yourself you measure the wrong state.
Always check logged out. A private browser window is enough.
And the leftovers in the database?
Two settings belong in the same direction, even though they load nothing:
Post revisions. WordPress stores intermediate states of a post as revisions. According to the wp-config handbook they are on by default and unlimited. With WP_POST_REVISIONS their number can be limited, for example to 3. Without a limit hundreds pile up over the years. They do not slow the page view, but they inflate the database and lengthen every backup.
Automatic saving. The interval can be set with AUTOSAVE_INTERVAL (in seconds). A somewhat longer interval reduces write operations without anyone losing anything. I use about five minutes.
How to check it yourself
You need no tool and no access to the server.
A look at the source. Open your home page in a private window, right-click and choose “View page source”. At the very top is the head. Read it through. Anything that stands there and means nothing to you is a candidate for the question: what is that for?
The Network tab. Press F12, switch to “Network” and reload the page. You see every single file with name and size. Sort by size. Names containing emoji, dashicons, heartbeat or block-library are the ones from this article. This is the more reliable of the two checks, because it shows what was actually loaded.
Count along. How many requests does your home page make? And how many of them can you assign to a purpose you really offer?
What you can do, ordered by effect
- First narrow down the block styling. On pages with few blocks it brings a lot and is harmless, because only what does not occur on the page is left out.
- Then leave out the icon font for logged-out visitors.
- Then end the background connection in the public area, but keep it in the administration area.
- Then the functions you do not use: emoji, embeds, password strength, old compatibility layer, self-links. Each is small, together they are several requests.
- Then tidy up the head. It costs no load time but makes the page more honest about what it offers.
- Last, limit revisions and lengthen the saving interval. That affects the database and the length of your backups and not the load time.
A warning at the end
There are plugins for all this, and some of them are good. But the temptation to flip all the switches at once is big, and that is exactly where mistakes come from.
Every component switched off is a promise that nothing needs it. A theme can use the icon font for a menu. A plugin can use the embed function for its display. You do not notice at once but two weeks later at a spot nobody connects with the switch any more.
So: flip one at a time, then look at the page, logged out. And note what you switched off, so that in a year someone still knows why a detail is missing.
That is the unspectacular truth here: no trick and no secret, but a list that someone goes through patiently once and documents.
Sources
- WordPress Developer Resources, print_emoji_detection_script — the core outputs the emoji detection script: developer.wordpress.org(external site: developer.wordpress.org)
- WordPress Developer Resources, should_load_separate_core_block_assets — default “false”: all block styling is loaded even when not needed; with “true” only when needed: developer.wordpress.org(external site: developer.wordpress.org)
- WordPress Developer Resources, Heartbeat API — the timer runs every 15 to 120 seconds: developer.wordpress.org(external site: developer.wordpress.org)
- WordPress Developer Resources, Editing wp-config.php —
WP_POST_REVISIONS(default: on),AUTOSAVE_INTERVAL: developer.wordpress.org(external site: developer.wordpress.org) - WordPress.org, Embeds — the embed block takes the address of a foreign page: wordpress.org(external site: wordpress.org)
- WordPress.org, Settings Discussion Screen — avatars come from Gravatar by default: wordpress.org(external site: wordpress.org)
- Own testing practice — the grouping into three, the icon font for anonymous visitors, the background connection in the public area, password strength and compatibility layer, the entries in the head, the self-links, the saving interval, the order by effect, checking logged out, flipping one switch at a time and documenting.