WP_query : meta_key with custom rule for specific value

I’m a bit stuck with a WP_Query code. Here it is : $args = array( ‘post_type’ => ‘post’, ‘meta_query’=> array( ‘key’ => ‘karma’, ‘compare’ => ‘>=’, ‘value’ => 0, ‘type’ => ‘numeric’), ‘posts_per_page’ => 9, ‘meta_key’ => ‘karma’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘DESC’, ‘post__not_in’ => $dont_show_me ); What I want to do : Show … Read more

Building a scalable WordPress favouriting plugin – one serialised meta value array or many meta records

I am trying to build a simple WordPress favourite post plugin that is scalable and could handle 1000s or 10000s of users or more. There are several different approaches that I have seen in other plugins and I would like to know which would be best practice from a scalability point of view, which means … Read more

How can I display all values of a custom field from posts with a certain value of another custom field or from certain post types?

I know the question is quite ambiguous. Let me explain: I have a page that lists all posts with a certain value of a custom field. (Eg.: The page Rentals lists all posts with the value rental of custom field offer_type ). I’d like to add a filtering option by city, so that only posts … Read more

Custom WP_Comment_Query with pagination and orderby?

I’m trying to setup a custom WP_Comment_Query which is ordered by a meta key. (It might be worth mentioning that these comments are being retrieved with AJAX.) It all works fine, until I add in pagination into the query args. $orderby = ‘top-comments’; $args = array( ‘post_id’ => $post_id, ‘type’ => ‘comment’, ‘status’ => ‘approve’, … Read more

Is it possible to orderby multiple meta_keys when using meta_value_num?

Reading through the order & orderby documentation, it’s not clear to me whether there is any support to order based on multiple meta_key values. Obviously, using meta_query I can return posts based on multiple key-value pairs, but I want to be able to control the order that these results are returned based on multiple meta_keys. … Read more