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.

A favorite, but It’s not that kind of filter.
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.