Skip to content

Difference Between WP_HTTP & Page Requests in WordPress

WP_HTTP Requests sounds a lot like “Page Request” but it is different. Let me show you how it is different and why you should optimize both of them.

Watch this video on YouTube.

More WP_HTTP videos can be found in my playlist.

Quick comparison WP_HTTP vs Page requests

Main difference between WP_HTTP and Page Requests in table view.

Here is the quick comparison table that shows how different they are.

WP_HTTP requests HTML page requests
✔️ Managed by this plugin ❌ NOT managed by this plugin
Also known as: API calls, external requests, remote requests, PHP requests, CURL, web hooks, server requests. Also known as: page assets, page requests, browser requests.
Requests performed in your web server inside PHP files while generating web page. Performed in client browser after page generated and loaded to web browser.
Load data from Web API; WordPress core, plugin, theme updates; plugin news, plugin addons, stats etc. Loads page asset files to the browser: JavaScript, CSS, images, fonts, videos etc.
Effects Time To First Byte (TTFB) Effects: First Contentful Paint (FCP), Largest Contentful Paint (LCP) & Cumulative Layout Shift (CLS)

WP_HTTP is a class inside WordPress website. It is used by wordpress core, plugins and themes to communicate with other websites (servers).

Page request is just loading additional files related to the web page via browser. It is used on all websites, not only WordPress websites.

WP_HTTP Request ≠ Page Request

Main difference is:

  • WP_HTTP request is server to server communication. Example: API calls, update checks, installing plugins from repository.
  • Page request is Browser to Server communication. Example: loading page related assets like images, javascript files, CSS files, Fonts, videos, audio files.

Let’s look at how you can view each of those request types.

How to view WP_HTTP requests?

To view WP_HTTP requests use the HTTP Requests Manager plugin. It is designed to log and monitor all WP_HTTP requests inside WordPress website.

You can learn which request is happening, which domains requests are sent to, which plugins sending those requests, on which pages WP_HTTP request happens, how long it takes to send request and get response etc.

View WP_HTTP requests using HTTP Requests Manager plugin.

From this screenshot you can see that requests are made to api.wordpress.org domain and took around 0.4 seconds to complete.

As every WP_HTTP request happens while generating a web page you can see how much your pages are slowing down.

View WP_HTTP requests details. Request and response data, time to complete request and total page generation time.

By clicking on an individual request you can see details of that WP_HTTP request.

From the screenshot you can see that the request took 0.4 seconds, and the total page time was 1.2 seconds. Without this request page would load in just 0.8 seconds.

Additionally you can see what is sent with a request. As well as a response from a remote server.

Learn more about WP_HTTP class on wordpress.org.

Now let’s look at page requests.

How to view Page Requests?

Page requests are happening between your web browser and server. You can view it with Google Chrome by pressing F12 and then navigating to the “Network” tab. Then refresh page to see how page requests loading.

You can also view page requests with online page speed measurement tools.

Google PageSpeed Insights shows Page Requests. Assets like image, css, js files.

Check this screenshot from “PageSpeed Insights” that shows Page has 5 requests to images, .css and .js files. Files have small size which is good for having a fast loading website.

Page requests by loading time in form of a waterfall visible in speedvitals website.

Here is a screenshot from SpeedVitals website. It is a waterfall view of Page requests. You can see how long each page request took to load.

View Page Request count and size breakdown by file type.

In this screenshot from the same report you can see breakdown by asset (page request) type. In total I have 9 requests. One is the page itself and 8 are page requests.

You can also see that the total page size was 137 kb.

Both total size and total number of requests is small which is good for having a fast loading website.

Why to optimize WP_HTTP and Page Requests?

We learned that WP_HTTP request and Page request are different from each other. On the same page you may have both of them.

WP_HTTP is used while generating pages.

Page request is used when loading a page.

Optimizing both of them is essential for having a fast WordPress website.

Conclusion

We learned that each request type is different.

WP_HTTP requests can be viewed with the HTTP Requests Manager.

Page requests can be viewed in browser or using online speed testing tools.

What is next:

Leave a Reply

Your email address will not be published. Required fields are marked *