You don’t specify where exactly the error comes from but I assume your problem is that you assign an object to the slug instead of a string.
your code should look like
$t = array_shift( $terms );
$params['slug'] = $t->slug;
You don’t specify where exactly the error comes from but I assume your problem is that you assign an object to the slug instead of a string.
your code should look like
$t = array_shift( $terms );
$params['slug'] = $t->slug;