remove error_logging
check that `$terms` is an array before trying to merge it
removed dangerous backtrace
since get_terms is an expensive operation, added some internal caching to prevent re-fetching (from @mjangda wordcamp talk)