Taxonomy term migration

Last updated on
30 April 2025

In migrating taxonomy terms, the key is mapping the legacy vocabulary to the destination vocabulary. Note that up till now we've dealt with classes that you will generally instantiate once - this is our first example of classes you would instantiate multiple times, one for each vocabulary to migrate.

  • source_vocabulary: The unique identifier of the legacy vocabulary (a machine name in Drupal 7, or a vid for earlier Drupal versions).
  • destination_vocabulary: The unique machine name of the destination vocabulary.
// In this example, we're consolidating two legacy vocabularies into one
$photo_term_arguments = $common_arguments + array(
  'machine_name' => 'ExamplePhotoTerm',
  'description' => t('Import Drupal 6 photo terms into media terms'),
  'source_vocabulary' => '3',  // "Photo category" vocabulary
  'destination_vocabulary' => 'media_category',
);
Migration::registerMigration('DrupalTerm6Migration', 
  $photo_term_arguments['machine_name'], $photo_term_arguments);

$video_term_arguments = $common_arguments + array(
  'machine_name' => 'ExampleVideoTerm',
  'description' => t('Import Drupal 6 video terms into media terms'),
  'source_vocabulary' => '5',  // "Video category" vocabulary
  'destination_vocabulary' => 'media_category',
);
Migration::registerMigration('DrupalTerm6Migration', 
  $video_term_arguments['machine_name'], $video_term_arguments);

For help with the Migrate UI and taxonomy migration, see also Advanced field mappings.

Help improve this page

Page status: Not set

You can: