Я думаю, что этот запрос поможет вам достичь вашей функциональности .. Попробуйте этот запрос, чтобы получить все эти сообщения ...
$parent = 2; //change as desired or get all parent post ids
$child_args = array(
'post_type' => 'post',
'post_parent' => $parent
);
$keys = array($parent);
$ids = array_merge($keys, array_keys( get_children( $child_args ) ));
$query = new WP_Query(
array(
'post_type' => 'post',
'post_status' => 'publish',
'post__in' => $ids,
'posts_per_page' => -1
)
);