Query on custom field count?
The following code allows you to add the parameters wpse4528_key and wpse4528_minimum to your queries, and will then add an extra criterium to the where clause that counts the number of meta values with your key. add_filter( ‘posts_where’, ‘wpse4528_posts_where’, 10, 2 ); function wpse4528_posts_where( $where, &$wp_query ) { global $wpdb; $count_key = $wp_query->get( ‘wpse4528_key’ ); … Read more