According to the codex, to query posts that can belong to any of a collection of categories, we need to do something like this:
$query = new WP_Query( array( 'cat' => '2,6,17,38' ) );
However, I have the following, which works, and I'm not sure why.
$args = array( 'cat' => $related_cat_ids, 'posts_per_page' => -1, ); $query = new WP_Query($args);
The reason why I'm confused is because $related_cat_ids is actually an array, but the example clearly shows a string of numbers, seperated by commas, for the 'cat' value.
Is this something I should be concerned about? Will my code all of a sudden stop working in a future WordPress release? It's more convenient for my case to keep using the array, rather than format it into that string. The reason being is that I'm using
get_the_category() to get the categories dynamically, and then pushing the IDs from that array into my new array.