In my last post, I pointed out that digiKam doesn’t always keep the tag hierarchy straight because of missing parent tags and the format in which the tags are stored in the file metadata. I’ve also noticed that when you move a child tag (with associated photos) within the tree, digiKam doesn’t “clean up” by re-tagging the file with the new parents or removing the old ones. Also, when you assign two subtags with the same parent, then remove one of them, you will lose all the parent tags unless you reapply them again.

The problem isn’t really apparent in the digiKam interface — it only shows up when you look at the metadata for the file. The only solution to correct this appears to be to set the “Toggle Auto/Parents” option (found by right-clicking on any tag in the left-hand Caption/Tags sidebar), use the Tags tree browser to select each tag, select all associated photos, then use the Caption/Tags sidebar to re-apply the same tag by unchecking and checking it again. That forces all the correct parent tags to be re-applied.

Once you’ve done so the first time, as long as you are careful after that (and keep the “Toggle Auto/Parents” option set), you should be able to avoid the same problem in the future.