WordPress core is not heavy, but the themes, plugin you use may slow down the overall page load time. There are many techniques to speed up your WordPress website. For example:
Using CDN (Content Delivery Network)Leveraging browser & server cachingHosting on performance-optimized serverUsing a lightweight theme
However, do you know there are many things included in WordPress core which you may not use it and take necessary action on them may cut down a few bytes to load the website faster. The following can be done in two ways, first, by using some plugin and second, by adding a few lines of code in functions.php.I prefer not to use a plugin if things can be done with the code addition/modification in an existing file. Best Practice Take a backup of the respective file you are going to modify so if something goes wrong; you can roll-back quickly. All the below codes to be added in functions.php unless specified differently.
Remove Query Strings
If you have analyzed your website for load time, then you might have come across a recommendation to eliminate query strings from static resources (CSS, JS files). Having query strings in the files may cause CDN not to cache the files; hence you may not be utilizing all caching benefits provided. To remove the query strings, add the following code.
Remove RSD Links
RSD (Really Simple Discovery) is needed if you intend to use XML-RPC client, pingback, etc. However, if you don’t need pingback or remote client to manage post then get rid of this unnecessary header by adding the following code.
Disable Emoticons
Remove extra code related to emojis from WordPress which was added recently to support emoticons in an older browser.
Remove Shortlink
Starting from version 3, WordPress added shortlink (shorter link of web page address) in header code. For ex: If not using shortlink for any functionality then you can remove them by adding below.
Disable Embeds
WordPress introduced oEmbed features in 4.4 which allows any site to embed WordPress post remotely and it looks like this. By adding the following code, it will prevent others from embedding your blog post and disable loading related JS file.
Disable XML-RPC
Do you have a requirement to use WordPress API (XML-RPC) to publish/edit/delete a post, edit/list comments, upload file? Also having XML-RPC enabled and not hardened properly may lead to DDoS & brute force attacks. If you don’t need then disable it by adding below.
Hide WordPress Version
This doesn’t help in performance but more to mitigate information leakage vulnerability. By default, WordPress adds meta name generator with the version details which is visible in source code and HTTP header. To remove the WP version, add below code.
Remove WLManifest Link
Do you use tagging support with Windows live writer? If not remove it by adding below.
Remove JQuery Migrate
WordPress added JQuery migration from version 3.6. This is not needed if you are using the latest version of JQuery and themes/plugin are compatible with it. To remove jquery-migrate.min.js from loading, add below code.
Disable Self Pingback
I don’t know why you need the self-pingback details on your blog post and I know it’s not just I get annoyed. If you are too then below code will help.
Disable or Limit Post Revisions
Post revisions in WordPress are not new and helpful to restore the post if browser crash or lose the network. But ask yourself, how many times did it happen? By default, WordPress will save revisions for each draft or published a post, and this can bloat the database. You may either choose to disable it entirely or limit the number of revisions to be saved. Add the following in wp-config.php file To disable post revisions To limit the number Let’s say limit to keep max two revisions Note: this must be above ABSPATH line else it won’t work.
Disable Heartbeat
WordPress use heartbeat API to communicate with a browser to a server by frequently calling admin-ajax.php. This may slow down the overall page load time and increase CPU utilization if on shared hosting. If you don’t have a requirement to use heartbeat API, then you can disable it by adding below.
Disable Dashicons on Front-end
Dashicons are utilized in the admin console, and if not using them to load any icons on front-end then you may want to disable it. By adding below, dashicons.min.css will stop loading on front-end.
Disable Contact Form 7 JS/CSS
Using Contact Form 7 and noticed their CSS/JavaScript files are getting loaded on every page? Well, you are not alone. The good news is you can stop loading it with below code. Conclusion Above will help to reduce a few HTTP request and overall page size. All the codes are available on Github. If you are looking for a premium caching and performance optimization plugin, then check out WP Rocket.