Forums

[2.5] wp_list_pages "exclude" arg no longer works as advertised (12 posts)

  1. lyzadanger
    Member
    Posted 5 months ago #

    I just upgraded to WP 2.5.

    I am building navigation on the front page of my client's site using wp_list_pages() with some excluded pages using the "exclude" parameter. This worked as expected in 2.3.x.

    After the upgrade, the excluded pages are not showing up, but all of their sub-pages are. Additionally, they are rendering as
    LIs at the same level as the top-level pages (i.e. they are not in a sub-list (ul) so are impossible to style invisible as a workaround). The docs specifically say:

    "Excluding a Page will also exclude all of its sub-pages from the list to be generated."

    Does anyone know of a quick workaround I could enact to fix this issue? Is it a known issue? Searches of the forums/bug DB are not returning much for me.

    Thanks!

  2. Otto42
    Moderator
    Posted 5 months ago #

    Post it on trac, let the developers know.

  3. lyzadanger
    Member
    Posted 5 months ago #

    Duly posted
    http://trac.wordpress.org/ticket/6510

    Now to figure out if I need to downgrade for now...

  4. rudolf45
    Member
    Posted 5 months ago #

    You could, eventually, use the depth parameter to hide children Pages.

  5. jsherk
    Member
    Posted 5 months ago #

    Wonder if this is related to my have_posts function problem?? See here...

    http://wordpress.org/support/topic/164871

  6. jsherk
    Member
    Posted 5 months ago #

    If you are not using default permalinks, change the setting back to default permalinks and see if the problem goes away. There is something weird that custom permalinks is doing on some blogs!!!

  7. turtlerabbit
    Member
    Posted 5 months ago #

    This seemed to work for me.. Just remove / comment out the following line: $r['hierarchical'] = 0;
    You can find that in wp-includes/post-template.php

    Thanks vincentrich for pointing this out! http://wordpress.org/support/topic/164745?replies=2

  8. creativeslice
    Member
    Posted 5 months ago #

    Thanks turtlerabbit. Your solution of commenting out line 323 on /wp-includes/post-template.php worked great!

  9. dave_t
    Member
    Posted 4 months ago #

    Thanks turtlerabbit! Good temporary fix. Just need to watch out for auto upgrades now...

    Just for completeness if anyone's searching, this bug also affects wp_list_pages handling of private or hidden pages, not just those specified by exclude.

    In my case, wp_list_pages was not listing the private pages themselves, but would list all their (non-private) children (non-indented) at the top level of the li hierarchy. Potentially disastrous for anyone relying on this to rapidly hide whole site sections eg areas in development.

  10. dave_t
    Member
    Posted 4 months ago #

    hey all

    I just upgraded to WP 2.5.1, and it appears that wp_list_pages is behaving as expected again, without the need for the fix outlined by turtlerabbit above.

    I didn't see the relevant support ticket (#6510) addressed specifically in the list of fixes, but one of the other fixes must have done the trick for this too...

  11. Sjeiti
    Member
    Posted 3 months ago #

    I wonder what 2.5.1 version you have. I just tested on localhost and wp_list_pages will still return the children of an exluded page. Trac doesn't say it's closed either.

  12. crondeau
    Member
    Posted 2 months ago #

    I just upgraded one of my blogs yesterday from 2.5 to 2.5.1 and found this same problem. Thank you for providing the temporary solution. I would have never thought to go look in there.

Reply

You must log in to post.

About this Topic