WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 2 years ago

#29975 new defect (bug)

exclude_tree doesn't work in wp_list_pages

Reported by: onetrev Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.0
Component: Posts, Post Types Keywords: needs-patch needs-unit-tests reporter-feedback
Focuses: Cc:

Description

This is a follow-up to #9153.

From my initial testing, if there are multiple exclude_tree arguments in wp_list_pages() it continues to only exclude the first ID in the list.

I am not sure if this ever fully worked for me in WP 3.9, as I've already updated all my sites, but in testing with WP 4.0 I am definitely seeing this issue. I am hoping someone else can confirm this bug still exists (exists again) and we can patch this up again as it definitely would be nice to have this bug fixed.

Change History (7)

#1 @miqrogroove
3 years ago

  • Summary changed from Regression? This bug seems to exists in WP 4.0 to exclude_tree doesn't work in wp_list_pages

#2 @helen
3 years ago

  • Keywords reporter-feedback added

Thanks for the report, sorry we missed this. Is this still an issue?

#3 @onetrev
3 years ago

Yes, the bug still exists. I completed another test. This time with a totally fresh install of WP 4.1. No plugins running.

As per this bug report from way back #8683 the same thing still happens, whereby it only excludes the last tree (ID) listed.

Hopefully we can get this get this little bug fixed up for 4.2! Thanks!

Last edited 3 years ago by SergeyBiryukov (previous) (diff)

#4 @helen
3 years ago

  • Keywords needs-patch needs-unit-tests added; reporter-feedback removed

Would need unit tests demonstrating the bug along with the patch to fix it.

#5 @dkotter
2 years ago

So tried reproducing this today and was not able to, things worked fine for me. I'm using 4.2-beta2 for reference.

I tried using both the comma-delimited string notation:
wp_list_pages( array( 'exclude_tree' => '1,2,3' ) );

and using an array:
wp_list_pages( array( 'exclude_tree' => array( 1, 2, 3 ) ) );

and didn't experience any issues with either approach. Both excluded all pages (and any descendant pages they might have) that I passed in, not just the first one.

#6 @DrewAPicture
2 years ago

  • Keywords reporter-feedback added

Hi @onetrev, can you please post a code snippet where you're seeing unexpected results with the exclude_tree argument?

#7 @onetrev
2 years ago

Hmm, okay well this is embarrassing. I was so darn sure I could reproduce this before I opened the ticket originally, but now through multiple attempts everything seems fine.

Suppose it's not a bad thing, as I think this can be safely closed as fixed. Sorry again for this mix up.

Last edited 2 years ago by onetrev (previous) (diff)
Note: See TracTickets for help on using tickets.