Filter CPT posts by one or more categories

Actually, the query was working as expected.

The problem was that with the pagination call:

the_posts_pagination(array(
    'screen_reader_text' => 'Navigation',
    'prev_text'          => '<i class="fa fa-angle-left" ></i>',
    'next_text'          => '<i class="fa fa-angle-right" ></i>',
));

From reading the code and finding this question on StackOverflow, I discovered that the function the_posts_pagination is a wrapper for the function get_the_posts_navigation which uses $GLOBALS['wp_query']->max_num_pages to know the number of pages to paginate. And because I’m using a custom query, my pagination was out of context.

I hope this helps someone.