Make WordPress Core

Opened 18 years ago

Closed 17 years ago

#6551 closed defect (bug) (fixed)

get_adjacent_post doesn't exclude categories

Reported by: filosofo's profile filosofo Owned by:
Milestone: 2.5.1 Priority: normal
Severity: normal Version: 2.5
Component: Template Keywords: needs-patch 2nd-opinion
Focuses: Cc:

Description

So get_previous_post and get_next_post both can't exclude categories.

It would be great to get this into the 2.5 branch, since it's such a simple fix.

Attachments (1)

fix_get_adjacent_post.diff (518 bytes) - added by filosofo 18 years ago.

Download all attachments as: .zip

Change History (14)

#1 @lloydbudd
18 years ago

#4304 marked a dup of this.

#2 @ryan
18 years ago

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

(In [7667]) Fix category exclusion when getting adjacent posts. Props filosofo. fixes #6551 for trunk

#3 @ryan
18 years ago

(In [7668]) Fix category exclusion when getting adjacent posts. Props filosofo. fixes #6551 for 2.5

#4 @ryan
18 years ago

  • Milestone changed from 2.6 to 2.5.1

#5 @TylerMartin
18 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

The fix doesn't completely fix the problem. Even with the fix in place, if the post in the excluded category is also in any other category, the fact that it is in the excluded category is ignored and the post is not excluded from navigation (which is not the behavior of previous WordPress versions).

#6 @ryan
17 years ago

  • Milestone changed from 2.5.2 to 2.9

Milestone 2.5.2 deleted

#7 @scribu
17 years ago

  • Milestone changed from 2.9 to 2.6.1

I think this error might be related:

[30-Jul-2008 01:18:56] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') WHERE p.post_date > '2007-05-24 17:38:40' AND p.post_type = 'post' AND p.post_' at line 1 for query SELECT p.* FROM blog_posts AS p  INNER JOIN blog_term_relationships AS tr ON p.ID = tr.object_id INNER JOIN blog_term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id AND tt.taxonomy = 'category' AND tt.term_id IN () WHERE p.post_date > '2007-05-24 17:38:40' AND p.post_type = 'post' AND p.post_status = 'publish' AND tt.taxonomy = 'category' ORDER BY p.post_date ASC LIMIT 1 made by get_adjacent_post

#8 @westi
17 years ago

  • Milestone changed from 2.6.1 to 2.6.2

2.6.1 has been released, moving to 2.6.2 milestone

#9 @matt
17 years ago

  • Keywords has-patch removed
  • Milestone changed from 2.7 to 2.8

No patch for current problem, moving to 2.8.

#10 @Denis-de-Bernardy
17 years ago

  • Milestone changed from 2.8 to Future Release

db error described by scribu no longer should occur in trunk based on what I'm reading.

whether the behavior described by TylerMartin is correct is debatable.

#11 @Denis-de-Bernardy
17 years ago

  • Keywords needs-patch 2nd-opinion added; get_adjacent_post get_previous_post get_next_post removed

#12 @Denis-de-Bernardy
17 years ago

  • Component changed from General to Template

#13 @Denis-de-Bernardy
17 years ago

  • Milestone changed from Future Release to 2.5.1
  • Resolution set to fixed
  • Status changed from reopened to closed
  • Version changed from 2.6 to 2.5
Note: See TracTickets for help on using tickets.