Hierarchical taxonomies in permalink cause 404 for sub term archive

I’ve not reviewed your code, just a quick thought:

Have you tried Going to Settings => Permalinks and just clicking ‘Save Changes‘? That flushes the rewrite cache.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)