I would suggest using WP_Query()
instead. Like so:
<?php
$category = 'whatever';
$new_query = new WP_Query(
array(
'post_type' => 'post',
'posts_per_page' => -1,
'category_name' => $category;
)
);
if ($new_query->have_posts()) {
$i = 0;
while ($new_query->have_posts()) {
$new_query->the_post();
$postid = get_the_ID();
// Your output code.
}
}
wp_reset_postdata();
?>
Merely change $category
to whatever you need. Make it an array() if you want to have several categories.
If however, you will be doing this for a custom post type, you need to use the tax_query
array, like so:
'tax_query' => array(
array(
'taxonomy' => 'people',
'field' => 'slug',
'terms' => 'bob',
),
),
Above example is taken straight from the WordPress Codex.