WordPress.org

Ready to get started?Download WordPress

Forums

Exclude children from a PARTICULAR parent? (7 posts)

  1. bryan868
    Member
    Posted 5 years ago #

    When using wp_list_pages, is there anyway to exclude children pages from only a PARTICULAR parent?

    I know to exclude all children I can do: &depth=1
    And I COULD exclude these children one by one using ID's.

    Just wondering if there's another way.

  2. MichaelH
    Member
    Posted 5 years ago #

    There's exclude_tree (Note: exclude_tree argument seems to be broken if excluding more than ONE tree--see https://core.trac.wordpress.org/ticket/9153 for a fix.)

  3. bryan868
    Member
    Posted 5 years ago #

    Aw man, how did I overlook that in the Codex?!

    Thanks Michael!

  4. bryan868
    Member
    Posted 5 years ago #

    Actually I realized this doesn't work for my purposes.

    exclude_tree also excludes the parent. I just want to exclude the parent's children.

  5. bryan868
    Member
    Posted 5 years ago #

    I need something like.... exclude_child_of

  6. korythewebguy
    Member
    Posted 5 years ago #

    I'm submitting this to the "Ideas" section if it's not already there - Useful as exclude_tree is, it would be nice to also have an exclude_children argument for wp_list_pages that excluded ONLY the children and not the parent as well.

  7. pitchit
    Member
    Posted 4 years ago #

    I am wanting to exclude all the child pages on my sidebar list. Is there now an easy way to do this?

Topic Closed

This topic has been closed to new replies.

About this Topic