Software Engineering in WordPress, PHP, and Backend Development

Author: Tom (Page 50 of 427)

Installing Multiple Coding Standards

I’ve talked about the importance of using coding standards (whatever standard you opt to use it up to you) and how to get PHP CodeSniffer (especially with Visual Studio Code) set up in several posts.

But there’s an interesting challenge that comes if you want to configure multiple coding standards with PHPCS. And this isn’t that strange a scenario, either.

Imagine you have several different projects on which you’re working – one uses WordPress’ coding standards, one uses PSR2, and one uses some other set of rules defined by the organization for which you work.

And you want to add them all as options to your configuration.

Continue reading

A Misaligned View: Prioritizing Peers Over Users

How many times have you looked at someone’s code and stated:

I’m not using this because it doesn’t look well-written.

And in this case, “look well-written” might either be a substitute for:

  • “look like how I would write it,”
  • “seem to make sense to me.”

Sure – there are times where using open source code is risky. We know this from the various software and services that show up with vulnerabilities. But, at least for this post, treat those as the exception – not the rule.

This means we’re left with looking at something we may use but opt not to use because it doesn’t seem to be written in a way that we think it should be written.

Continue reading

Using Direct Database Queries to Quickly Update Data, Part 2

This is the second, and final part, in a series about – as the title suggests – direct database queries. Specifically, it’s about changing post statuses (but it’s relevant to more than that).

Photo by Ross Findon on Unsplash

From the previous post:

This is yet another post that’s going to be an illustration of how to use $wpdb to quickly update information based on metadata.

And the code provided in that post works but if you’re looking to make it more object-oriented, then there’s more work that can be done.

Before jumping into the actual post, though, it’s important to note that when it comes to object-oriented programming, there’s a lot of work that can go into the class design and creating levels of abstraction.

At some point, you have to draw the proverbial line between when you’re going to use interfaces, how granular your classes are going to be in terms of what they are abstracting, and the like.

And the purpose of this post is to help provide a better object-oriented design but it’s not an exercise is making this as optimal as possible. I do discuss topics like this in another series of posts.

But keep that in mind when reading through the code throughout the rest of the post.

Continue reading

Privacy is Hard: File Syncing

When we’re working on a variety of devices – be it our computers, our tablets, or even our phones – it’s definitely convenient to have access to certain types wherever we are, right?

And with files aside, our phones have such powerful cameras now; it’s nice also to have the ability to store our photos but also to free up space on our phones (although this may be a tertiary issue for you regarding file syncing).

Anyway, there are a lot of services that are available that allow you to store your files in the cloud and to access them anywhere. It’s easy to tout security and privacy and, yes, we can do things on our end like enable two-factor authentication.

But what about the actual files themselves? That is, we can make it more difficult to log in and access the files but what about those on the other side who work at the company responsible for storing the files?

Continue reading

Using Direct Database Queries to Quickly Update Data, Part 1

This is not the first time I’ve mentioned this, but one of the challenges that come with talking about writing direct database queries to update information in the WordPress database is that you leave yourself open to something like:

Yeah, but there’s an API to do something just like that.

And, in many cases, that’s right. I’m a big fan of using ’em, too. But there are times where direct, parameterized database queries can be a more optimal choice.

Direct Database Queries, Part 1

No, it’s not a database but wouldn’t it be awesome if they looked like this? Photo by Tobias Fischer on Unsplash

This is, of course, contingent on the environment in which you’re working the requirements of your project.

So this is yet another post that’s going to be an illustration of how to use $wpdb to quickly update information based on metadata (without using something like WP_Query or WP_Meta_Query to handle it).

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑