Software Engineering in Web Development, Backend Services, and More

Search: “wp_query” (Page 9 of 29)

We found 145 results for your search.

On Writing Readable WordPress Functions

[…] Further Let’s take this a step further though and say that products do exist and we want to retrieve all of their post IDs. Doing this with WP_Query is pretty easy but let’s say, for kicks, we want to interface with the database directly. Note this is more of an exercise of showing a […]

Rapid Prototyping: Prototype To Code, Part 2

[…] we’ve also updated the query only to pull back three posts (as per this comment). View the code on Gist. Notice in the code, I’ve also pre-fixed  WP_Query with a slash because it’s part of the global namespace. Let’s move into the Display directory and take a look at the Meta Box class. This has also […]

Selecting DISTINCT Records in WordPress

If you need to write a query against the WordPress database, grab a reference to `$wpdb` and get to work, right?

In some instances, sure. I’m not opposed to this. After all, the API exists for a reason. But sometimes, I think we bypass built-in APIs. We go straight for `$wpdb` without looking to see if other hooks already exist.

If a hook exists, why not use it? It’s one level of abstraction above the database and it uses the native API.

As mentioned in a previous post, I want to cover a few ways to customize queries that run against the database.

Case in point: selecting `DISTINCT` records from WordPress.

« Older posts Newer posts »

© 2026 Tom McFarlin

Theme by Anders NorenUp ↑