Delete any path alias by language
How can I gain access to the path aliases for es and zh-hans?


To get all path alias by language for instance es: 

$path_alias_manager = \Drupal::entityTypeManager()-&gt;getStorage('path_alias');
// Load all path alias for this node for es language.
$alias_objects = $path_alias_manager-&gt;loadByProperties([
  'path' =&gt; '/node/' . $nid,
  'langcode' =&gt; 'en'
]);



  I need to delete the duplicate Spanish path alias


$path_alias_manager = \Drupal::entityTypeManager()-&gt;getStorage('path_alias');
// Load all path alias for this node for es language.
$alias_objects = $path_alias_manager-&gt;loadByProperties([
  'path'     =&gt; '/node/' . $nid,
  'langcode' =&gt; 'es',
]);

// Get the actual associated spanish path alias to your node.
$spanish_associated_alias = \Drupal::service('path.alias_manager')-&gt;getAliasByPath('/node/' . $nid, 'es');
foreach ($alias_objects as $alias_object) {
  // If its not the actual alias delete it.
  if ($alias_object-&gt;get('alias')-&gt;value !== $spanish_associated_alias ){
    $alias_object-&gt;delete();
  }
}