Hi, today I've needed select an Array of highest rated categories and for this I've make some improvements on the function
get_highest_rated_category.
I put this:
if(is_array($category_id)) {
$cat_filter = "IN (".join(",", $category_id).")";
} else {
$cat_filter = "= $category_id";
}
Before the
$highest_rated = $wpdb->get_results
and change
$wpdb->post2cat.category_id = $category_id
to
$wpdb->post2cat.category_id $cat_filter
Then for call the function for select from multiples categories i use (template):
<?php get_highest_rated_category(array(29,30,31,32), 'both', 100) ?>
Thanks for read it, i hope this information be helpful.