Make WordPress Core

Opened 14 years ago

Closed 14 years ago

Last modified 6 years ago

#17673 closed defect (bug) (fixed)

get_adjacent_post() uses ' and ' as undocumented separator for excluded categories

Reported by: kawauso's profile kawauso Owned by: ryan's profile ryan
Milestone: 3.3 Priority: normal
Severity: normal Version: 3.1
Component: Template Keywords: has-patch commit 3.3-early
Focuses: Cc:

Description

get_adjacent_post() (and all derivative functions) use a non-standard and undocumented separator for IDs passed for $excluded_categories and have no support for either commas or an array.

Attachments (3)

17673.diff (7.9 KB) - added by solarissmoke 14 years ago.
17673.2.diff (9.7 KB) - added by solarissmoke 14 years ago.
Accept arrays as well as comma-separated strings
17673.3.diff (9.8 KB) - added by solarissmoke 14 years ago.

Download all attachments as: .zip

Change History (18)

#1 follow-up: @nacin
14 years ago

  • Milestone changed from Awaiting Review to 3.2

That's one of the weirder things I've seen. Let's fix this.

#2 in reply to: ↑ 1 @westi
14 years ago

  • Milestone changed from 3.2 to Future Release
  • Version changed from 3.2 to 3.1

Replying to nacin:

That's one of the weirder things I've seen. Let's fix this.

[1557] seems to be the source.

Therefore this is not a 3.2 issue.

@solarissmoke
14 years ago

#3 @solarissmoke
14 years ago

  • Keywords has-patch added

Patch changes $excluded_categories to a comma-separated list, consistent with get_boundary_post(), get_posts() and related functions. Also makes this clear in the inline docs.

#4 @nacin
14 years ago

  • Keywords commit added

I would not mind seeing this for 3.2 anyway.

#5 @dd32
14 years ago

dare I say we should attempt to introduce array||comma separated notation whenever changes like this area made?

(But yes, this is a 3.3 thing)

#6 @solarissmoke
14 years ago

Second patch accepts arrays as well. While writing this I noticed that there was a bug in get_boundary_post() - $excluded_categories was being reset to an empty array so it would never exclude anything. Seems nobody uses that feature, otherwise they would have noticed..

@solarissmoke
14 years ago

Accept arrays as well as comma-separated strings

#7 @dd32
14 years ago

I'd change that check to if ( !is_array($excluded_categories) ) for 2 reasons, is_string() will return false for ints, and, it's best to check to see if something is not in the expected form and process (in turn, casting to string magically by php) parsing the inputs.

#8 @solarissmoke
14 years ago

dd32: done - I'll keep that in mind for future also.

#9 @kawauso
14 years ago

  • Keywords 3.3-early added

Everyone's favourite bug is coming up for its 7th birthday!

#10 @SergeyBiryukov
14 years ago

  • Milestone changed from Future Release to 3.3

#11 @billerickson
14 years ago

  • Cc bill.erickson@… added

#12 @ryan
14 years ago

  • Owner set to ryan
  • Resolution set to fixed
  • Status changed from new to closed

In [18477]:

Support an array or comma-seperated list of excluded category IDs in get_adjacent_post(). Props solarissmoke. fixes #17673

#13 @nacin
14 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Let's _deprecated_argument() that.

#14 @nacin
14 years ago

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

In [18478]:

Fire _deprecated_argument() for get_adjacent_post()'s crazy excluded_categories 'and' thing. fixes #17673.

#15 @SergeyBiryukov
6 years ago

In 45033:

Docs: Correct back-compat reference to $excluded_categories in get_adjacent_post().

See #46543, #17673.

Note: See TracTickets for help on using tickets.