Quantcast
Channel: Toolset » All Posts
Viewing all articles
Browse latest Browse all 20145

Unwanted child posts with get_posts

$
0
0

Hi everyone, I need some help here. I'm trying to populate a dopdown with titles of a custom post type.
I use this snippet to get posts:

$args = array (
'post_type' => 'customposttype',
'numberposts' => -1,
'post_parent' => '0'
'orderby' => 'title',
'order' => 'ASC',
);
$attivita = get_posts($args);

Then i use foreach to echo titles.
Unfortunately what I get is a list of titles of both the custom post type I want AND its children :(
How can I get rid of children using get_posts?


Viewing all articles
Browse latest Browse all 20145

Trending Articles