Just noticed that 3.1 added a new filter to customize queries: posts_clauses. All I could find about it is that instead of using the separate query filters like posts_where or posts_join, you can edit them all in one go. I was wondering if someone could give an example of the usage of the new “posts_clauses” filter?
Leave a Reply
You must be logged in to post a comment.
Below is the query I found somewhere and was going through it. The purpose of query is to sort the posts based on taxonomy. So, I am sharing the code so it might help you understand the use of posts_clauses.
here is the source where I found the above query: http://scribu.net/wordpress/sortable-taxonomy-columns.html
The answer from scribu / Hameedullah is a great pointer, but it will hide posts that are a member of a different taxonomy (e.g. ‘category’), but not of ‘color’. I have modified the code, and this seems to work great: