Software Engineering in Web Development, Backend Services, and More

Search: “wp_query” (Page 8 of 29)

We found 145 results for your search.

Modifying the WHERE Clause in WordPress

When retrieving data, there times where you may want to change the WHERE clause in WordPress. That is, depending on what you’re retrieving, you may want to filter what it’s searching.

And that’s exactly what a `WHERE` clause does. But just as we’ve looked at content in other posts, we can alter the `WHERE` clause via the WordPress API.

In previous posts, I’ve covered:

– Displaying the last query, which is useful when doing light debugging.
– Selecting `DISTINCT` records
– Performing a `JOIN` on two tables

Here, I’ll show how to use the API to change the `WHERE` clause so you’re not having to do so through a custom query.

Separation of Concerns with Queries and Helper Functions

[…] and Helpers For those who have built more complicated themes (or even plugins), there’s a significant chance that you’ve had to write custom queries by using ` WP_Query`, `WP_User_Query`, or `$wpdb`. Even if you haven’t done that, there’s a chance you’ve written helper functions to help process information prior to rendering it to the […]

Learn WordPress Development with Curtis McHale

[…] plugins. How to deal with javascript, ajax and CSS properly in a theme or plugin. How to get content out of the database with `get_posts` or ` WP_Query` and warns agains `query_posts`. It also introduces you to actions and filters in WordPress. Of course, it’s much easier for me to share what the author […]

JOIN Two Tables in WordPress

In a previous posts, I’ve talked about how to:

– View the last query that WordPress executed
– Select `DISTINCT` records in WordPress

There’s a lot more to do than just viewing the last query and selecting distinct rows, though. For example, you can also JOIN two tables in WordPress without having to write raw SQL.

So to be consistent with some of the previous posts, I thought I’d share how to do this using the WordPress API .

« Older posts Newer posts »

© 2026 Tom McFarlin

Theme by Anders NorenUp ↑