I’m trying to create a simple post query where the categories are an array. The return type is Term ID
Here is my code so far…
$topics = get_field('blog_post_categories');
if ($topics) {
if (!is_array($topics)) {
$topics = array($topics);
}
$args = array(
'post_type' => 'post',
'posts_per_page' => -1,
'order' => 'DESC',
'cats' => $topics
);
$query = new WP_Query( $args );
any help would be greatly appreciated
There is no “cats” argument for WP_Query().
https://developer.wordpress.org/reference/classes/wp_query/#category-parameters
try “cat” with a comma separated string of category IDs or “category__in” with an array.