$wpdb->update($wpdb->postmeta, array('meta_value' => $location->location_id), array('meta_key' => '_location_id', 'meta_value' => $EM_Location->location_id)); $EM_Location->ms_global_switch_back(); do_action('em_ml_transfer_original_location', $location, $EM_Location); //other add-ons with tables with location_id foreign keys should hook here and change } } } /** * When saving an original location, save shared meta to translations as well. * @param boolean $result * @param EM_Location $EM_Location * @return boolean */ public static function location_save_meta($result, $EM_Location) { if ($result && EM_ML::is_original($EM_Location)) { //save post meta for all others as well foreach (EM_ML::get_langs() as $lang_code => $language) { $location = EM_ML::get_translation($EM_Location, $lang_code); /* @var $EM_Location EM_Location */ if ($location->location_id != $EM_Location->location_id) { self::location_merge_original_meta($location, $EM_Location); $location->save_meta(); } } } return $result; } } EM_ML_IO::init();