Software Engineering in WordPress, PHP, and Backend Development

Author: Tom (Page 143 of 428)

WordPress Ajax Responses in JSON

WordPress Ajax responses are things that I’ve written about several times in the past (and it’s because I do a lot of work with Ajax in WordPress and because I often see other code that uses it in a variety of ways).

WordPress Ajax Responses: Implement a client-side call.

Implementing a call to the server from the client-side.

Of course, I’m not trying to set a definitive way to using WordPress, Ajax, JSON, and so on; otherwise, I wouldn’t spend my time writing posts about it, but there are things that I think are important to cover if for no other reason than to serve as reminders both to myself and those reading.

In the last year, I’ve written:

  1. Ajax in WordPress: A Strategy For Error Codes
  2. Writing a Custom Protocol for Ajax Responses
  3. An Example of the Ajax API

And sure, some of the above posts are a bit out of date. All the more reason to write updated content, right?

Since I recently finished a series on implementing custom protocols, I thought it important to also remember that there are already ways to send WordPress Ajax responses if you’re looking for something a bit simpler.

Continue reading

Pragmatic Development in WordPress

Pragmatic development in WordPress is not a phrase or a term that I’ve found, read, or that exists (to my knowledge) outside this particular post. The idea has come from two sources:

  1. The Pragmatic Programmer by Dave Thomas and Andy Hunt,
  2. And a couple of projects that I’ve been working on recently.

I want to use the standard definition of “pragmatic” before I get into the rest of this post:

dealing with things sensibly and realistically in a way that is based on practical rather than theoretical considerations.

With that said, I think there are a few things we can learn from this as it relates to applying pragmatic development in WordPress projects.

Of course, this raises the question of what type of situations calls for this?

Continue reading

Improving WordPress Resource Requests

A couple of weeks ago, I talked about WordPress resource requests and how there’s a level of performance with which we have to comfortable when we’re building solutions on top of the application.

In the post, I shared a comment by a friend (who no longer works within WordPress, but did for several years):

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.

And now, just as I did then, I don’t disagree with him. But after sharing the post, several different utilities were shared with me each of which aiming to improve this problem.

JJJ‘s WP Enqueue Masher – a fork of an Automattic project – does exactly this.

Continue reading

Using a PHP Autoloader in WordPress

If you’re using namespaces when working on your WordPress plugins (or whatever project you have going on), then you’re likely also taking advantage of a PHP autoloader.

PHP Autoloader in WordPress

Though this post isn’t really meant to be a tutorial on how to use them (I have another one of those coming up later), here’s the gist of what an autoloader is (or does):

One of the biggest annoyances is having to write a long list of needed includes at the beginning of each script (one for each class) … By registering autoloaders, PHP is given a last chance to load the class or interface before it fails with an error.

It’s a feature that, if your environment supports it, should be used. But I digress.

The point of this post is how to combat the potential problem you may encounter when using a PHP autoloader in your code and alongside other plugins.

Continue reading

Debugging WordPress (The Right Way)

Debugging WordPress projects is one of those things that WordPress developers seem to approach differently.

Though there are certainly different ways to do it, I’m of the mind that using a debugger is the most effective way to, ahem, debug a project. I’m not saying that to try to be a purist, but the benefits of using an actual debugger far outweigh the alternatives.

But in WordPress, it seems that using facilities built into PHP are far more prevalent than using software specifically designed for debugging.

Sometimes, I think this comes with the nature of looking at other peoples code, and sometimes I think comes from not knowing where else to start.

But if there’s one thing that can not only help you become better at debugging projects and understanding source code, nothing can top debugging WordPress projects with an actual debugger.

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑