Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Rebuild taxonomy_index table for all nodes
$query = \Drupal::entityQuery('node');
$ids = $query->accessCheck(FALSE)->execute();
$storage_handler = \Drupal::entityTypeManager()->getStorage('node');
// If you have a lot of nodes, you may have to split this up via
// array_chunk() instead of trying to load all nodes at one time.
$entities = $storage_handler->loadMultiple($ids);
foreach ($entities as $entity) { 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment