I am currently using the following function to list the children of a page, however the function recursively finds children of the children and I only want to list the direct children of $post->post_parent.

wp_list_pages(array('child_of' => $post->post_parent,'exclude' => $post->ID))

Does anyone know how to do this?


Try this:

wp_list_pages(array('child_of' => $post->post_parent,'exclude' => $post->ID, 'depth' => 1))

Read the codex for more details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.