fix for 'tried to get property of non object error' when term ID is invalid

Was getting 'tried to get property of non object' errors on $terms
variable in init.php
Added check for is_wp-error and count > 0 for these cases. occurs if the
taxonomy metaboxes term ID is invalid

Probably needs further testing