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.

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

Ajax in WordPress: The Server-Side Ajax Protocol

When you’re implementing a protocol, you have to think about server-side ajax functionality and client-side Ajax functionality.

Though they work together to create a complete feature, they have to implement a protocol. And the way they implement the protocol is a bit different depending on which part of the application you’re focused on creating.

That is, the server-side is going to implement functionality and the protocol in one way, and the client-side is going to have its implementation on how it handles the response from the server.

Continue reading

Ajax in WordPress: Protocol Syntax

The Ajax protocol syntax is something that was briefly mentioned in the first post in this series. One of the things mentioned is that a protocol required:

Syntax which should be consistent.

That is, it’s not something that’s defined for us. On the contrary, we have the ability to define the Ajax protocol we want to use on a project-specific basis. I’m a fan of this because I find that different projects call for different semantics (in a number of ways, protocols not excluded).

Ajax Protocol Syntax: The phone

An early protocol. Kind of awesome. Product of a bygone era.

But, if you so choose, you can implement the same protocol syntax across your entire set of projects (though I’d find it difficult to think one protocol would match all use cases).

Regardless, this post will cover the first step in establishing an Ajax protocol syntax that you may (or may not) use in a WordPress project.

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑