/** * Save meta value * If field is cloneable, value is saved as a single entry in DB * Otherwise value is saved as multiple entries (for backward compatibility) * * TODO: A good way to ALWAYS save values in single entry in DB, while maintaining backward compatibility * * @param $new * @param $old * @param $post_id * @param $field */ static function save($new, $old, $post_id, $field) { if (!$field['clone']) { parent::save($new, $old, $post_id, $field); return; } if (empty($new)) { delete_post_meta($post_id, $field['id']); } else { update_post_meta($post_id, $field['id'], $new); } }
/** * Save meta value * * @param $new * @param $old * @param $post_id * @param $field */ static function save($new, $old, $post_id, $field) { delete_post_meta($post_id, $field['id']); parent::save($new, array(), $post_id, $field); }