When 0 (Zero) is the value, custom field returns nothing.
-
I am using custom fields to store numeric data. When I use add_post_meta or $wpdb->insert to add values to a post from a custom form submission, and that value is 0 (zero), … even when I save 0 (zero) directly into the post editor custom field entry method, when I edit the post the custom field where I should see 0 (zero) is empty.
I have:
- verified that the value 0 (zero) is in the WP table
- tried setting the custom field to be text and number
- (as mentioned) tried add_post_meta and $wpdb
Empty and zero are not the same. (I get that programmatically empty = 0 = false, but in this case, zero is not empty or false.) How can I return zero?
- The topic ‘When 0 (Zero) is the value, custom field returns nothing.’ is closed to new replies.