/** * Update _wp_attachment_metadata for just-inserted attachment * * @since 1.70 * * @param array Attachment metadata updates * @param array Attachment metadata, by reference; updated by this function * * @return array Attachment metadata updates, with "meta:" elements removed */ private static function _update_attachment_metadata($updates, &$data) { if (is_array($updates) and isset($updates['custom_updates'])) { $attachment_meta_values = array(); foreach ($updates['custom_updates'] as $key => $value) { if ('meta:' == substr($key, 0, 5)) { $meta_key = substr($key, 5); $attachment_meta_values[$meta_key] = $value; unset($updates['custom_updates'][$key]); } } // foreach $updates if (empty($updates['custom_updates'])) { unset($updates['custom_updates']); } if (!empty($attachment_meta_values)) { $results = MLAData::mla_update_wp_attachment_metadata($data, $attachment_meta_values); } } // custom_updates return $updates; }