WordPress requests (that is, page requests) are something that can become a bit of a hot topic for those who are concerned about the performance of web applications.

Case in point: Last week, I was having a conversation with a friend who, at one time, was doing a lot of work with WordPress and has since moved into another industry of web application development.

During the conversation, he made the following comment:

And the fact that it doesn’t min / cat files instead of [25] network requests is just plain dumb. And when a person has 23 plugins, that’s 26 files not even including the theme and core.

I adjusted the number above to reflect how this particular site performs with my current theme and my [admittedly small] set of plugins.

Page Requests: 25 for this site alone.

25 Wordress requests for all resources for this site alone (along with a JavaScript error).

And though the comment is meant to be humorous and a bit facetious, I don’t think it’s worth dismissing.

In fact, I believe that it’s something worth considering even if we’re simply building things on top of WordPress (versus working on WordPress core).

The Reality of WordPress Requests

The first two points I’d like to make are this:

  1. HTTP/2 should help improve the number of requests that any site makes to the service, and this will ultimately change how we minify and concatenate our files. But for now, it’s not the standard. We shouldn’t dismiss the problem on account of something that will eventually [and hopefully] come to pass.
  2. This is in no way an attempt to structure any argument like “Well WordPress may do it this way, but look at what [whatever other] piece of software does!” This isn’t about anything other than WordPress.

With that said, I’ve said – in various posts and several times over – that when it comes to working with WordPress as a foundation for project development, I believe that it helps to look at it as a black box.

Sure, there are parts regarding WordPress core that can be changed and should be optimized and all of that. And there are the usual statements about backward compatibility that remain valid.

All of that aside, I still look at WordPress as a black box that provides a set of APIs that allow me to call into the application (and, by necessity, the database) and read and write data from it. This is no different than how I looked at the .NET framework or the Ruby on Rails library even though the latter was open source, too.

WordPress Requests and Ruby on Rails

Ruby on Rails on GitHub

Ultimately, when someone hires me or my team to work on a solution for them, then it’s about the quality of what I can build on top of it. They aren’t looking for me to educate them on the performance of WordPress – I assume they’ve made the choice to use it already and are now looking for additional work. And that’s my responsibility.

So when it comes to the number of requests for a given page or set of pages in WordPress, the responsibility falls on me to make sure that I’m creating the least impact as possible. That doesn’t mean I won’t have many JavaScript files, but I can combine and minify them into a single file so that it results in just one more request.

I can’t worry about what other plugin developers are doing. I can’t worry about that other theme developers are doing. I can get irritated about it, but what will that accomplish?

And though they may be polluting the amount of network traffic required to get a site to render or function, or though they may be working to optimize the amount of network traffic, I have to treat my work as somewhat of an island within the larger world of the CMS.

I can control only things that are within my parameters. And such is true for anyone who is building a solution that runs on WordPress

WordPress is For Us

As far as WordPress core is concerned, I do not believe that the core developers do not care about the number of requests.

In fact, I think the opposite. I think that the core team cares about the optimization of the application and work very hard to make sure that it’s as performant as possible. Take, for example, the implementation of system fonts in the last release.

You can also choose to use SCRIPT_DEBUG if you’re working in development so you get the unminified versions of JavaScript (thus shows that scripts are minified in core applications).

So passing the buck further upstream doesn’t hold any water.

Is there room for improvement? Sure. But I’ve yet to see a piece of software that doesn’t have room for improvement. Could there be fewer requests on a given page load? Sure. But that doesn’t mean that we’re not working towards it.

Accepting Our Responsibility

Ultimately, the point I’m trying to make is two-fold:

  1. In the comment that opened the post, I don’t believe my friend is wrong. Empirical data shows just how many requests a given page requires. But I also know that it’s a problem that’s being resolved.
  2. When it comes to providing solutions for others, we have a responsibility as developers to be responsible for the amount of data our solution needs to function. High-bandwidth internet access and caching is not an excuse for poor development practices. We need to focus on optimizations in the areas in which we can control.

When it comes to shipping products for WordPress, there are always going to be those that win out, because they offer every feature possible. And it’s a shame we can’t educate customers about this.

But we’re not in the business of customer education. At least, we’re not in that business outside of the solutions we’re providing for them.

So when it comes to working with WordPress, you have to accept that there’s already overhead in the application but it’s getting better. And we have to accept the burden – for lack of a better term, really – of being responsible developers with respect to the requests our solutions make.