Skip to main content
added 87 characters in body
Source Link

Delete path alias: Drupal(8/9/10)

$path_alias_manager = \Drupal::entityTypeManager()->getStorage('path_alias');
// Load path alias by path
$alias_objects = $path_alias_manager->loadByProperties([
  'path' => '/node/' . $nid
]);
foreach ($alias_objects as $alias_object) {
  // Delete the path alias
  $alias_object->delete();
}  

Note: Drupal(8/9/10) "path" field column maintained instead of "source" column

Delete path alias: Drupal(8/9/10)

$path_alias_manager = \Drupal::entityTypeManager()->getStorage('path_alias');
// Load path alias by path
$alias_objects = $path_alias_manager->loadByProperties([
  'path' => '/node/' . $nid
]);
foreach ($alias_objects as $alias_object) {
  // Delete the path alias
  $alias_object->delete();
}  

Delete path alias: Drupal(8/9/10)

$path_alias_manager = \Drupal::entityTypeManager()->getStorage('path_alias');
// Load path alias by path
$alias_objects = $path_alias_manager->loadByProperties([
  'path' => '/node/' . $nid
]);
foreach ($alias_objects as $alias_object) {
  // Delete the path alias
  $alias_object->delete();
}  

Note: Drupal(8/9/10) "path" field column maintained instead of "source" column

added 68 characters in body
Source Link

Delete path alias: Drupal(8/9/10)

$path_alias_manager = \Drupal::entityTypeManager()->getStorage('path_alias');
// Load path alias by path
$alias_object$alias_objects = $path_alias_manager->loadByProperties([
  'path' => '/node/' . $nid
]);
foreach ($alias_objects as $alias_object) {
  // Delete the path alias
  $alias_object->delete();
}  

Delete path alias: Drupal(8/9/10)

$path_alias_manager = \Drupal::entityTypeManager()->getStorage('path_alias');
// Load path alias by path
$alias_object = $path_alias_manager->loadByProperties([
  'path' => '/node/' . $nid
]);
// Delete the path alias
$alias_object->delete();

Delete path alias: Drupal(8/9/10)

$path_alias_manager = \Drupal::entityTypeManager()->getStorage('path_alias');
// Load path alias by path
$alias_objects = $path_alias_manager->loadByProperties([
  'path' => '/node/' . $nid
]);
foreach ($alias_objects as $alias_object) {
  // Delete the path alias
  $alias_object->delete();
}  
Source Link

Delete path alias: Drupal(8/9/10)

$path_alias_manager = \Drupal::entityTypeManager()->getStorage('path_alias');
// Load path alias by path
$alias_object = $path_alias_manager->loadByProperties([
  'path' => '/node/' . $nid
]);
// Delete the path alias
$alias_object->delete();