Software Engineering in WordPress, PHP, and Backend Development

Tag: WordPress (Page 141 of 219)

Articles, tips, and resources for WordPress-based development.

Using WP_Query and Multiple Meta Keys

When it comes to searching the WordPress database, there’s probably no better API than WP_Query. That doesn’t mean it’s not without it’s limitations, though (only which will be improved over time, I’m sure).

For example, consider the case where you have two types of meta data that are completely unrelated and you need to run a search for both of them. Essentially, you have WP_Query and multiple meta keys that you need in order to search for information from this database.

In this specific case, I’m not talking about a single piece of meta data that has multiple keys and that would support and AND or and OR clause.

Instead, I’m talking about the idea of having multiple meta keys each of which are associated with a given post, but must all be searched in order to find the posts that have the data associated with it.

In more technical terms, I’m looking for the intersection of post IDs all of which share a common set of multiple, unrelated meta keys.

Continue reading

Check To See if a WordPress Post Has a Term

In yesterday’s post, I shared how to determine if a given term has a child term. The idea behind doing this is to check to see if a given WordPress term has a child and if the child is actively applied to the post (or post type) in question.

But there’s a caveat that I didn’t mention:

Just because a term has a child doesn’t mean the term itself is actually active.

This means that you could technically be getting a false positive if you’re using the previous method as your sole means to determine if a term has a child. Instead, you need to do one more thing: Check to see if the post has the term applied to it.

Continue reading

How To Check if a WordPress Term Has a Child

If you’re in the process of working with hierarchical terms, then there’s a chance that you’re eventually going to need to know if a given term is the parent to another term.

For example, let’s say that in one of your templates, you’re responsible for displaying a list of all of the terms that do not have children for one reason or another (or maybe you’re responsible for display only terms with one children or another).

Whatever the case, this is a relatively straightforward operation to do assuming that you have the term’s taxonomy readily available.

Continue reading

What Are You Doing Inside of WordPress?

I know – the title of this post is kinda weird, but I figured it made sense given yesterday’s topic (that is, what are you guys and girls focusing on outside of WordPress in the coming year?).

After all, just because we’re looking to focus on things outside of WordPress, that doesn’t mean that we’re going to be moving on or moving away from WordPress.

And since WordPress is comprised of so much – that is, core developers, plugin developers, theme developers, documenters, teachers, educators, event organizers, and so on – I’m interested in seeing what you’re planning to do in the coming year, as well.

Continue reading

What Are You Doing Outside of WordPress?

The end of the year usually breeds one of two types of posts (or, in some cases, both!):

  1. A look back over the year summarizing everything that you accomplished (or discussing what you didn’t get accomplished),
  2. Your plans for what you hope to get done in the New Year

And I’m no exception.

Granted, I’m not one that’s big on resolutions – I tend to think that the best time to start something new is whenever you decide to start something new, but I know that bringing in a new year brings with it that feeling of starting over or a clean slate and with that comes ideas for what you hope to get done.

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑