Software Engineering in WordPress, PHP, and Backend Development

Category: Articles (Page 108 of 258)

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

Using Configuration Files for Class Properties

The idea of using some type of configuration files for a project isn’t anything new. Nor is the idea of using a format such as JSON.

Look in any directory for a number of major applications that you use, be it a source control manager, IDE, a build tool, et al., and you’re likely to find some type of configuration file. (And when it comes to build tools, many of us already write configuration files using JSON specifically to tell the build tool information about our project.)

Configuration Files as seen in VS Code.

Configuration Files as seen in VS Code.

Yesterday, I shared some of the challenges that can come with creatively solving problems and said that I was going to talk about something I’ve been working on:

With all of that said, it wouldn’t be particularly honest of me if I didn’t discuss and share my code, though, would it?

So that’s the purpose of this post: To talk about one way that I’ve been looking to solve a problem in a project on which I’m working.

Continue reading

The Intimidation of Creatively Solving Problems

One of the things about programming in the same “environment” for an extended period is that you get comfortable with the way you tackle similar problems.

Case in point:

When you start writing a plugin, you likely have an idea as to how you will implement something before writing it.

I’d venture to say that this begins to happen while the client is describing their problem. I don’t think there’s anything inherently wrong about this. In fact, I believe that it’s probably a good thing as it’s a sign you’re learning your way around the API, how to structure files, assets, and so on.

But at what point do we start coasting on autopilot? Or, perhaps a better way to ask it, is when are we just going through the motions of solving different-but-similar problems?

Continue reading

Desktop Applications via the WordPress REST API?

There are a lot of reasons that people are excited to have the WordPress REST API merged into core.

The WordPress REST API Plugin

I think some are excited because they won’t need to include the plugin dependency anymore; others, honestly speaking, I think are happy to see it merged for the sake of it. Whatever the case, having the entire infrastructure is core is neat, and I’m excited, but almost none of the client work I’m doing at the moment warrant it.

I believe that will change, though, as people learn what we can do with it. But until that time comes, one of the things I like to do is try to think broadly about what could the REST API offer that isn’t directly related to blogging.

And this leads me to a much broader question.

Continue reading

Working with Associative Array Values in WordPress

Spend enough time working in WordPress, and you find that a lot of data is often held in arrays (and multidimensional arrays, at that). I’m not arguing whether or not this is a bad thing or a good thing; it’s more of an intermediary step between grabbing something from the database and then rendering it on the page.

As you venture into the world of WordPress development, though, and you aren’t necessarily sure how you want to manipulate some of that data before rendering it, saving it, or working with it, you may ask yourself the following question:

How do I read the associative array values in WordPress?

And if you have experience in PHP, this isn’t something that’s terribly difficult. But if you’re working with an existing structure or trying to extend or manipulate something that already exists,

Associative Array Values: Look at all the serialized options.

Look at all the serialized options.

But if you’re still learning the ropes and you start trekking down the PHP manual, you’re likely to find something like array_values or array_intersect_key or something like that only to find out that you’re more confused than when you’ve started.

So what are you to do?

Continue reading

Should We Use PSRs or WordPress Coding Standards?

It probably gets a bit tiresome to talk about coding standards, practices, and things like that when you’re trying to focus on simply getting things done.

And though I get it, I also think that having standards and practices – at least within the context of your team – can go a long way regarding being productive, writing maintainable code, and having things in place to help with maintenance over time.

PSRs or WordPress Coding Standards: The PSRs

All of that’s beside the point, though. In the last few years, I’ve found that WordPress – at least those who work on the server-side – usually come in two flavors:

  1. Those who follow the WordPress Coding Standards,
  2. Those who follow the PSRs.

I think there are good reasons for choosing either one. Naturally, I’d say that because I’ve almost always used the WordPress Coding Standards (I have very few exceptions), but I understand the choice to use the alternative as well.

PSRs or WordPress Coding Standards: The WordPress Coding Standards

And it’s something I’m beginning to consider doing, too. But I’m curious, for anyone who’s used both or who has an opinion (strong or otherwise) on which one and why to share.

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑