Skip to content

Log or Optimize WP_HTTP requests in WordPress?

WP_HTTP requests used for many features inside WordPress. But WordPress does not have a built-in feature to log or optimize those requests. I developed and used the HTTP Requests Manager plugin to log and optimize all WP_HTTP requests on WordPress websites.

Watch this video on Youtube.

View playlist for all WP_HTTP videos.

WP_HTTP requests are also known as External Requests.

Here are operation modes that will help to log or optimize WP_HTTP requests.

Log WP_HTTP requests

Logging is good to see what external communications are happening inside your website.

It is good for learning:

  • What information is sent to other servers?
  • What information do you get from external servers?
  • How often does external communication happen?
  • How much external requests slow down your website?

You will get answers to all these questions by logging WP_HTTP requests.

Select operation mode for logging or optimizing WP_HTTP requests.

Operation modes for just logging WP_HTTP requests.

Only log HTTP requests

Good for viewing external requests happening inside WordPress. You will see detailed information about each request. All sent and received information from remote servers.

Cron jobs are also started by sending WP_HTTP requests to cron job URL on your own website. Because there are too many cron job calls this mode will not log them. This is done in order to keep logs clean without much noise.

If there are any WP_HTTP requests happening inside cron jobs then you will see them without problem. Because the cron page itself will be recorded as a page with an external WP_HTTP request.

Only log HTTP requests (+ cron requests)

In this operation mode cron job calls will be logged in addition to regular WP_HTTP requests.

You will see lots of cron job calls. More than 90% of requests will be occupied by cron job calls.

It will be difficult to find requests other than cron job calls.

Use this mode if you are investigating how often cron jobs are called. Optimize WP_HTTP Requests

Now we have seen how logging works. Lets see how to optimize WP_HTTP requests.

Optimize WP_HTTP requests

In optimization modes HTTP Request Manager will block some requests as well as fine tune request parameters like request timeout.

Optimization modes will make your wordpress website faster. Depending on the mode you chose you can expect big speed improvements.

Also some optimization modes will block external requests to other domains which can help to prevent communication to external services. Which will act as a security measure as well.

All optimization modes will log WP_HTTP requests as normal. It will record logs similar to “Only log HTTP requests” mode.

Let’s see operation modes for WP_HTTP optimization.

Smart block

“Smart Block” is the preferred optimization mode for WP_HTTP requests. It makes sure that WordPress is fully functional while some not important or slow requests are blocked.

If you want to increase website performance while keeping it functional then this mode is for you.

Additionally you can fine tune WP_HTTP request blocking operation by creating “Custom Rules” for allowing or blocking certain requests by plugin or domain.

Custom rules work only in Smart Block mode.

Learn more about how “Smart Block” optimizes WP_HTTP requests with examples.

Block external requests

Do you want to block all external requests to other domains. Then this mode is for your. Your website will be fast.

Functionality that relies on external servers will not work. This applies to WordPress core functionality as well.

For example you will not be able to update, install new plugins, get translation, add new themes, view plugin information from repositories, search for new plugins etc.

All external communication for plugins will also be blocked.

This is a preferred optimization mode for development websites. Localhost, staging, testing websites can use this mode.

Learn more about blocking all external requests in WordPress.

Block external requests (allow WordPress.org only)

This operation mode will allow default WordPress communication and block all other external requests.

In this mode updates, new plugin and theme installation will work.

Use this mode if you do not want any plugin or theme to connect to external servers.

It is also the second best option after “Smart block” to optimize WP_HTTP requests while keeping WordPress functional.

Conclusion

Logging is good for analyzing WP_HTTP requests without breaking your website.

It is also good for identifying important requests for allowing them later with “Custom Rules”.

Optimization on other hand will speed up your website and prevent wasting resources for sending useless WP_HTTP requests. If you have a slow website then optimization is the way to go.

What is next:

Leave a Reply

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