Make WordPress Core

Opened 16 years ago

Closed 15 years ago

Last modified 15 years ago

#6510 closed defect (bug) (worksforme)

[2.5] wp_list_pages "exclude" arg no longer works as advertised

Reported by: lyzadanger's profile lyzadanger Owned by: hailin's profile hailin
Milestone: Priority: normal
Severity: normal Version: 2.5
Component: General Keywords:
Focuses: Cc:

Description

[c'n'p'ed from a post I put in the support forums]

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 (expected), but all of their sub-pages are (definitely unexpected). 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."

Thanks!

Change History (8)

#1 @hailin
16 years ago

  • Owner changed from anonymous to hailin
  • Status changed from new to assigned

I will take a look.

#2 follow-up: @hailin
16 years ago

This issue is caused by a statement ($rhierarchical? = 0)
in post-template.php.

I believe Ryan put there because he wanted to improve the performance of page listing.

post-template.php


Query pages.
$rhierarchical? = 0; <== caused the issue !!
$pages = get_pages($r);

We probably need to rethink about how to take advantage of the fact that new walker class no longer depends on pages being in certain order. (perhaps we don't need to store pages in options anymore, thus making import much faster).

#3 @lloydbudd
16 years ago

  • Milestone changed from 2.7 to 2.6

#4 @Otto42
16 years ago

  • Resolution set to duplicate
  • Status changed from assigned to closed

Dupe of #6277

#5 @Otto42
16 years ago

  • Resolution duplicate deleted
  • Status changed from closed to reopened

Undo, my bad, this is not a dupe.

#6 in reply to: ↑ 2 @jamescollins
16 years ago

Replying to hailin:

This issue is caused by a statement ($rhierarchical? = 0)
in post-template.php.

I believe Ryan put there because he wanted to improve the performance of page listing.

post-template.php


Query pages.
$rhierarchical? = 0; <== caused the issue !!
$pages = get_pages($r);

I can confirm that commenting out this line fixes the problem. This change was made in ticket #5458 (revision [6399]).

#7 @hailin
15 years ago

  • Resolution set to worksforme
  • Status changed from reopened to closed

Discussed with Ryan befoer, it appears this little change is more or less intended,
and it does not have any significant effect. No more complaints heard since 2.6, and 2.7. So close it.

#8 @mrmist
15 years ago

  • Milestone 2.9 deleted
Note: See TracTickets for help on using tickets.