Prevent possible PHP error by validating the taxonomy term value before formatting

Signed-off-by: Elliot Condon <e@elliotcondon.com>