wp_list_pages() Function - 'exclude_children' argument would be useful

  1. korythewebguy


    First and foremost, I cannot express my thanks enough to the developers of WordPress - It is a fantastic product with a million uses, and to have it made available free & backed by such an incredible community is truly something amazing.

    Flattery aside, I have been developing WordPress sites for nearly 4 years now, and after writing my own page list code a number of times have concluded it would be quite useful to have an exclude_children argument for wp_list_pages():


    I do appreciate that the 'exclude_tree' argument is now working in WP 2.8+, but it excludes both both children & parents.

    Having exclude_children would allow wp_list_pages() to output the page list, excluding only the children of specific parent pages and not the parent pages themselves.

    Any additional thoughts on this suggestion (or posting of some clever code to accomplish this) are very genuinely appreciated!

    Posted: 8 years ago #
  2. Jake Goldman
    10up Engineer


    Agreed / seconded. Only efficient way to do this now is a query based on parent ID combined with a long exclude list.

    Posted: 8 years ago #
  3. Robert Chapin


    Seems convoluted to me. If you can't get what you want with the depth, include, and exclude arguments, then you need custom logic anyway.

    Posted: 8 years ago #

RSS feed for this topic


You must log in to post.

  • Rating

    9 Votes
  • Status

    This idea has been implemented