Make WordPress Core

Opened 11 years ago

Closed 10 years ago

Last modified 10 years ago

#4304 closed defect (bug) (duplicate)

get_next_post/get_previous_post category exclusions still broken

Reported by: stewartjohnson Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.2.1
Component: Template Keywords: has-patch
Focuses: Cc:


This was broken up until version 2.1 (see the history of it at RonR's site).

It's still broken in WP 2.1.3. For WP 2.1.3 the code in get_next_post and get_previous_post has some harmless bugs (for example $sql_exclude_cats is declared and never used) but there's one bug preventing the fourth parameter from working correctly at all.

There’s a one line fix for WP2.1.3 to get this code to work. In both functions, this line (lines 294 and 331 in link-template.php):

$sql_cat_ids = " OR pc.category_ID = '$category'";

should be changed to

$sql_cat_ids .= " OR pc.category_ID = '$category'";

(changed = to .=)

I have tested this fix on my own installation and it works correctly.

Attachments (1)

category_exclusion_fix.patch (1.8 KB) - added by stewartjohnson 11 years ago.
SVN patch to fix the bug, and add some missing error checking on intval()

Download all attachments as: .zip

Change History (6)

11 years ago

SVN patch to fix the bug, and add some missing error checking on intval()

#1 @stewartjohnson
11 years ago

  • Keywords has_patch added

#2 @rob1n
11 years ago

  • Milestone changed from 2.4 to 2.3
  • Version changed from 2.3 to 2.2.1

#3 @stewartjohnson
11 years ago

  • Keywords has-patch added; has_patch removed

#4 @filosofo
10 years ago

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

Your ticket was first, but it's so old that it's using the old category structure, so I'm closing as a dupe of #6551

#5 @lloydbudd
10 years ago

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