Display sibling pages including current page in WordPress

I have a page structure like this:

  • Food

    • Cheese
    • Fruit
    • Meat
    • Sweets
  • Music

    • Rock
    • Dance
    • Folk

When on a child page, I want to a menu that shows the siblings, including the current page. For example, if I am on the ‘Fruit’ page I want to see:
Cheese Fruit Meat Sweets

‘Fruit’ should not have a link because it is the current page.

I’ve tried this, but it doesn’t include the current page:

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

Read more here: Display sibling pages including current page in WordPress

Leave a Reply

Your email address will not be published. Required fields are marked *