WordPress.NewCitizen.io

Speed Optimization Guide

Your Attention Please !

After selecting your desired 'Optimization' section from the table, please scroll again to the very bottom of the page to view the material.

A complete and Comprehensive Guide On Making WordPress websites faster.

Don’t be overwhelmed by the table below; most optimizations can be easily achieved with an optimization plugin. I personally use the free Speed Optimization plugin that comes bundled with SiteGround’s Hosting plan. However, there are several other options, including W3 Total Cache (W3TC), WP Rocket, and FlyingPress.

Steps to optimizing your WordPress website :

1. Visit GTmetrix: Enter your website’s URL to begin the test. GTmetrix offers this tool for free and allows multiple tests to be performed every hour, at no charge.

2. Review the Report: GTmetrix will quickly generate a performance report, pinpointing each area that requires improvement.

3. Consult our table below to address the specific areas highlighted by GTmetrix. While GTmetrix often uses complex terminology, overcomplicates its instructions, and provides guidance for a broad spectrum of websites, we’ve streamlined and tailored their recommendations specifically for WordPress sites. With our clear and straightforward guidelines, you’ll find it much easier to understand and implement the necessary changes.

4. Re-test After Implementing Changes: After making a change, clear your website’s cache if it’s enabled. Re-test on GTmetrix to assess the impact of your adjustments. Using the new results, move on to the next suggested improvement and continue the process.

Implementing this feature can be achieved by using an Optimization Plugin:

 

 

Avoid Document.Write()

The JavaScript method document.write() writes content directly into an HTML document. Its use is discouraged due to potential adverse effects on web performance, such as delayed page load times and render-blocking.

Chrome Browser, aiming to protect user experience, might not run <scripts> injected via document.write() under certain conditions:

  • The user’s network is slow (e.g., 2G/3G or weak wifi).
  • The <script> is render-blocking.
  • The <script> is from a third party.
  • The <script> isn’t cached by the browser.
  • document.write() is in the primary document.
  • The page request isn’t a reload.

Yet, if not all conditions are met, Chrome may execute document.write(), which can greatly delay page loading, especially with third-party scripts.

How does using document.write() affect page performance?

Modern browsers use speculative parsing, preloading scripts, styles, and images identified while parsing, improving page load times. Using document.write() for scripts or other resources forces the browser to halt DOM construction, waiting for these resources. If a script injects another dynamically, the wait extends. Thus, document.write() can notably increase blocking time and page load duration, particularly on slow connections. Chrome intervenes to block document.write() only in severe situations outlined above.

For better web performance and improved user experience, it’s recommended to optimize the use of document.write().

How to Avoid document.write() issues in WordPress

  • By eliminating document.write() altogether, wherever possible.
  • Ideally, your development workflow should incorporate the avoidance of document.write() usage from the outset, ensuring that your production website is primed for optimal web performance.
  • If for some reason document.write() cannot be avoided, adding async tags to its <scripts> can enable asynchronous script loading and put a stop to render-blocking behavior. You can look at our optimization implementation to eliminate render blocking resources. Just as an FYI, this can be achieved by leveraging one of the many Optimization Plugins WordPress has to offer.