I have been importing a lot of data using feeds, then deleting all imported items again when there were problems with the import. Unfortunately, the URL aliases for the pages do not seem to be deleted, so they are related to nodes that no longer exist. Is there any way to remove them, other than going through by hand?

  • What makes you think that they have not been deleted?
    – No Sssweat
    Jul 20 '16 at 1:29
  • Because they are still there. I get the error "The alias is already in use." and if I search for them on the /admin/config/search/path multiple copies of the same URL come up, referencing old deleted pages.
    – James
    Jul 20 '16 at 1:39
  • Did you flush the cache? Are you using pathauto to create your aliases?
    – No Sssweat
    Jul 20 '16 at 2:08
  • Yes, I've tried flushing cache and running cron. The aliases were created by a feed import containing a path field.
    – James
    Jul 20 '16 at 3:20

A core bug causing this error was fixed for Drupal 8.2 and 8.3:

PathItem::delete() never runs because the path field type is a computed field in disguise

The fix for this problem, then, should simply be updating Drupal (...after having waited several months for this fix to be made and 8.2 released— but a satisfying answer now, i hope!)

  • 1
    Does this remove aliases that were orphaned in the past, or does it only fix the behavior that deletes the alias when a node gets deleted?
    – donquixote
    Feb 7 '20 at 17:39
  • 2
    Yes this will remove the ones that were orphaned in the past.
    – mlncn
    Feb 14 '20 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.