The tag has no wiki summary.

learn more… | top users | synonyms

3
votes
2answers
245 views

Extending WP_Query — Optimise SQL query

I'm storing posts, a user follows in a custom table that has the columns id, post_id and user_id. To fetch posts that a user follows I have extended the WP_Query as follows: class ...
2
votes
1answer
113 views

When querying a combination of posts and other meta fields, is there a better solution than directly modifying the WHERE value?

This question is a follow up to a question I recently asked. I've implemented what seemed to be the only solution, and it seems to work (YAY!). I just need to verify that: This is really the only ...
1
vote
1answer
467 views

How do I create my own nested meta_query using posts_where / posts_join?

Some of my posts (not all) have a price as a meta key/value. Today I use the pre_get_posts action so that my users can search for prices that are between a certain value. This is the code that I'm ...
0
votes
1answer
21 views

Use posts_where to exclude posts ids from wp_query

I want to use posts_where to exclude an array of posts ids from all queries in my site. The array containing the posts ids depends on the user that is logged in. Can someone please tell me how to ...
0
votes
1answer
72 views

using posts_where for meta data on pre_get_posts

Let's say you have some code which filters posts by using pre_get_posts e.g. add_action( 'pre_get_posts', 'be_exclude_category_from_blog' ); function be_exclude_category_from_blog( $query ) { ...
1
vote
0answers
10 views

How to search for posts IN OR title OR content OR author?

I have looked at many posts and questions regarding searches for custom meta, but I want to search for posts and include those if the search query matches an author name. I have come up with the ...
0
votes
0answers
7 views

How to add custom where condition in user listing at admin page?

I have found a posts_where filter to add custom where conditions in listing posts. Like this is there any filter to add custom where condition for listing the users? Thanks
0
votes
0answers
25 views

Check if the value of “meta2” is smaller than the value of “meta1”

function my_query($where) { global $wpdb; $where .= " AND SELECT $wpdb->posts.* FROM $wpdb->posts AS p, $wpdb->postmeta AS pm1, $wpdb->postmeta AS pm2 WHERE p.ID ...