try this
$posts = get_posts([
"post_type" => "ABCD", // put the custom type here
"post_parent__not_in" => "0", // parent is not root
]);
try this
$posts = get_posts([
"post_type" => "ABCD", // put the custom type here
"post_parent__not_in" => "0", // parent is not root
]);