WordPress.org

Ready to get started?Download WordPress

Ideas

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

  1. korythewebguy
    Member

    12345

    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():

    wp_list_pages('sort_column=menu_order&depth=2&exclude_children=3,7,10&title_li=')

    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: 4 years ago #
  2. Jake Goldman
    10up Engineer

    12345

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

    Posted: 4 years ago #
  3. Robert Chapin
    Member

    12345

    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: 4 years ago #

RSS feed for this topic

Reply

You must log in to post.

  • Rating

    12345
    9 Votes
  • Status

    This idea has been implemented