This method get_posts()
return all fields!
But i need to get custom fields, for example i wanna get only id
and title
and their categories name.
I think by passing parameter you could get what you want.
$args = array(
'numberposts' => -1, // -1 is for all
'post_type' => 'movie', // or 'post', 'page'
'orderby' => 'title', // or 'date', 'rand'
'order' => 'ASC', // or 'DESC'
);
// Get the posts
$posts = get_posts($args);
// If there are posts
if($posts){
// Loop the posts
foreach ($posts as $post){
var_dump($mypost->ID); // you have ID here
}
}