Software Engineering in WordPress, PHP, and Backend Development

Category: Articles (Page 112 of 258)

Personal opinions and how-to’s that I’ve written both here and as contributions to other blogs.

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

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

Ajax in WordPress: The Client-Side Ajax Protocol

A client-side Ajax protocol is arguably more about parsing the response from the server than it is implementing actual functionality.

This isn’t to say that as the server-side protocol mature, the client-side won’t as well. But, often, what changes on the server is what will dictate change on the client.

By that, I mean that if we’re to introduce a new message in the protocol, then it will be first added to the server-side protocol and then the client-side protocol will need to support it. Rarely will it happen the other way around (at least in the types of projects that are built on WordPress.

With all of that said, how do we support the protocol in JavaScript (or on the client-side)?

Continue reading

« Older posts Newer posts »

© 2026 Tom McFarlin

Theme by Anders NorenUp ↑