I'm going through some unpredicted behavior. I've added a custom filed of "Rating" to my posts. I wish to total the amount of posts having a certain rating:
$args = array( 'post_status' => 'publish', 'meta_query' => array( array( 'key' => 'rating', 'compare' => '=', 'value' => 7 ) ) ) $posts = new Wordpress_Query($args) echo $posts->post_count
After I set the worthiness to 7, it echos the right quantity of posts for your rating. But for whatever reason, basically set the worthiness to , it echos the entire quantity of released posts. What shall we be held missing?
I'm not sure precisely why, however when I want it I simply use compare = '<=' value = '0.5'
I believe wordpress use as empty or null var, rather than really zero.
Used to do just a little digging which seems to become dude to PHP's "empty" function. This really is slated to become fixed in WordPress 3.2. Particulars here: http://core.trac.wordpress.org/ticket/15292