Useful Snippets

Welcome!


This blog is used to collect useful snippets related to Linux, PHP, MySQL and more. Feel free to post comments with improvements or questions!

RSS Latest posts from my personal blog


Most viewed posts


Subscribe to RSS feed


WordPress Request Buster

Stanislav KhromovStanislav Khromov

WordPress has functions for getting remote resources (using cURL or PHP streams). When these functions run during a page load request, they will slow down your site, because WordPress has to wait for the external request before returning the page. This is bad practice, yet so many plugins and themes use it. Debugging is notoriously hard because requests appear only occasionally (they are often cached via the Transients API).

Request Buster is a plugin that shows you in the top admin bar if any remote requests were triggered by the current page load. Keeping it open as you develop and use your site will let you find plugins that make remote requests.

The plugin is available on GitHub – click here.

The correct way

The correct way to handle loading of remote resources are:

Here are the functions this plugin catches:

wp_remote_get
wp_remote_head
wp_remote_post
wp_remote_request
wp_safe_remote_get
wp_safe_remote_head
wp_safe_remote_post
wp_safe_remote_request

Web Developer at Aftonbladet (Schibsted Media Group)
Any opinions on this blog are my own and do not reflect the views of my employer.
LinkedIn
Twitter
WordPress.org Profile
Visit my other blog

Comments 0
There are currently no comments.