Ticket #6551 (closed defect (bug): fixed)

Opened 4 years ago

Last modified 3 years ago

get_adjacent_post doesn't exclude categories

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

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

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

Change History

#4304 marked a dup of this.

comment:2   ryan4 years ago

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

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

comment:3   ryan4 years ago

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

comment:4   ryan4 years ago

  • Milestone changed from 2.6 to 2.5.1
  • Status changed from closed to reopened
  • Resolution fixed deleted

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).

comment:6   ryan4 years ago

  • Milestone changed from 2.5.2 to 2.9

Milestone 2.5.2 deleted

  • 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
  • Milestone changed from 2.6.1 to 2.6.2

2.6.1 has been released, moving to 2.6.2 milestone

comment:9   matt3 years ago

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

No patch for current problem, moving to 2.8.

  • 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.

  • Keywords needs-patch 2nd-opinion added; get_adjacent_post, get_previous_post, get_next_post removed
  • Component changed from General to Template
  • Status changed from reopened to closed
  • Version changed from 2.6 to 2.5
  • Resolution set to fixed
  • Milestone changed from Future Release to 2.5.1
Note: See TracTickets for help on using tickets.