First, you can’t enter such expression as second argument in get_term()
. Enter directly the name of your taxonomy…
Are you dealing with simple post categories? If that’s the case, your taxonomy name is 'category'
.
$context['single_term'] = get_term( $user_terms_array[1], 'category' );
Second, ensure that $user_terms_array
contains term IDs as integer.
$user_terms_array = array_map( 'intval', explode( '-', $user_terms ) );
Then, you’re on the good way. Using WP_Term_Query
instead of get_term()
wouldn’t give you any pros if I refer to the supplied info. In this context, I’d stick with get_term()
.