I need to update all meta keys in the postmeta table that have a value other than 0, to the value of 0.
I tried this.. no love (though I cannot figure out why....):
$status = $wpdb->query("UPDATE {$wpdb->prefix}postmeta SET meta_value=0 WHERE meta_key = _wti_like_count AND meta_value <> '0'");
I'm on this concept, but how to say "!0" NOT 0 in the key list?
$wpdb->update('wp_postmeta', array('_wti_like_count' => '0'), array('_wti_like_count' => '0'));
Thanks a ton!
UPDATE: I fixed my $wpdb->query as follows and it works:
$status = $wpdb->query("UPDATE {$wpdb->prefix}postmeta SET meta_value='0' WHERE meta_key = '_wti_like_count' AND meta_value <> '0'");
However, I would still like to know if there is a way to pass a key pair array to the WHERE parameter of $wpdb->update and request a != value.