$data_update) { $previous_data = array_shift($previous_data); } update_post_meta($post_id, 'essb_metrics_data', $previous_data); } function essb_sm_merge_data($previous_data, $current_data) { foreach ($current_data as $key => $value) { $previous_data[$key] = $value; } return $previous_data; } function essb_sm_has_record($data, $date) { $position = -1; $count = 0; foreach ($data as $date_record) { $current_date = isset($date_record['date']) ? $date_record['date'] : ''; if ($current_date == $date) { $position = $count; } $count++; } return $position; }