• Hello, I want to exclude all pages which have no parent and a certain meta_value. Right now I have this below, but it filters all pages. I would like to get only the ones on top level, which have no parent. Can anyone help?

    <?php
    global $post;
    $args=array(
      'post_type' => 'page',
      'meta_key' => 'myextramenu',
      'meta_compare' => '=',
      'meta_value' => 'hideme'
    );
    $pages = get_posts($args);
    if ($pages) {
      $pageids = array();
      foreach ($pages as $page) {
        $pageids[]= $page->ID;
      }
    }
    ?>
    <ul>
       <?php wp_list_pages('exclude='.implode(",", $pageids)); ?>
    </ul>
  • The topic ‘exclude top level pages from wp_list_pages with meta_value’ is closed to new replies.