As suggested in a comment, the best approach here will be to make use of a tax_query
. You have much more flexibility and the ability to run more complex queries specially when you are working with more than one taxonomy (in this case category
and post_tag
).
You can try something like this
$args = [
'tax_query' => [
'relation' => 'AND',
[
'taxonomy' => 'category',
'field' => 'term_id',
'terms' => the_field('troubleshooting_category'),
'exclude_children' => true
],
[
'taxonomy' => 'post_tag',
'field' => 'term_id',
'terms' => 5,
],
],
];
$q = get_posts( $args );