WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. lyzadanger
    Member
    Posted 6 years 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. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Post it on trac, let the developers know.

  3. lyzadanger
    Member
    Posted 6 years ago #

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

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

  4. rudolf45
    Member
    Posted 6 years ago #

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

  5. jsherk
    Member
    Posted 6 years ago #

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

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

  6. jsherk
    Member
    Posted 6 years 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 6 years 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. Creative Slice
    Member
    Posted 6 years ago #

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

  9. dave_t
    Member
    Posted 6 years 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 6 years 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 6 years 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. 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.

  13. Sjeiti
    Member
    Posted 5 years ago #

    dave_t said: Just need to watch out for auto upgrades now...

    2.6.3 and still not resolved :-(
    What you can do if you don't want to fiddle in the wp-includes source files is copy the 'wp_list_pages' function from wp-includes/post-template.php to the 'wp-content/themes/*/functions.php' file and (rename the function to something else of course, and don't forget to delete $r['hierarchical'] = 0;).

Topic Closed

This topic has been closed to new replies.

About this Topic