get_pages( array( 'child_of' => $post->ID ) 不显示所有孩子

Aly*_*ope 5 wordpress

我对 wordpress 很陌生,想知道是否有人可以对这段代码有所了解。我正在尝试在其父页面上列出所有子页面,这是删除了一些 html 的代码:

<?php
$mypages = get_pages( array( 'child_of' => $post->ID ) );

foreach( $mypages as $page ) {      
    $content = $page->post_content;
    if ( ! $content ) // Check for empty page
        continue;

    $content = apply_filters( 'the_content', $content );
?>

<p style="color: white; text-transform: uppercase;"><?php echo $page->post_title; ?></p>

<?php
   }   
?>
Run Code Online (Sandbox Code Playgroud)

代码有效,并显示正确的子页面 - 但不是全部。显示了 7 个最旧的帖子,但没有显示我本周创建的最新页面。我已经检查并仔细检查所有新旧页面在各个方面都相同 - 相同的模板、相同的父页面、相同的创建者、相同的订单号,并且都已发布。任何人都知道我可能做错了什么?

Ash*_*tel 1

尝试下面的代码:

$args = array('child_of' => $post->ID,'sort_order' => 'desc',
'sort_column' => 'ID',
);
Run Code Online (Sandbox Code Playgroud)