0

I have a get_pages() function. I all works great but I only want all the post_id's in my variable. Is that possible?

Thanks in advance.

$countries = get_pages(array(
    "hierarchical" => 0, 
    "sort_column" => "menu_order", 
    "sort_order" => "desc", 
    "meta_key" => "page_type", 
    "meta_value" => 2,
));
0

Quick shot:

$countries = get_pages(array(
    "hierarchical" => 0, 
    "sort_column"  => "menu_order", 
    "sort_order"   => "desc", 
    "meta_key"     => "page_type", 
    "meta_value"   => 2,
));
$page_ids = array();
foreach ( $countries as $country ) {
    $page_ids[] = $country->ID;
}

Not the answer you're looking for? Browse other questions tagged or ask your own question.