In Drupal 7, a path alias can be deleted with code similar to the following one.
path_delete(array('source' => "problem/{$problem->nid}/{$problem_src->nid}"));
How can I delete path aliases in Drupal 9?
Thanks..
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