Ticket #4304 (closed defect: duplicate)

Opened 1 year ago

Last modified 5 months ago

get_next_post/get_previous_post category exclusions still broken

Reported by: stewartjohnson Assigned to: anonymous
Priority: normal Milestone:
Component: Template Version: 2.2.1
Severity: normal Keywords: has-patch
Cc:

Description

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

category_exclusion_fix.patch (1.8 kB) - added by stewartjohnson on 05/20/07 16:24:25.
SVN patch to fix the bug, and add some missing error checking on intval()

Change History

05/20/07 16:24:25 changed by stewartjohnson

  • attachment category_exclusion_fix.patch added.

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

05/20/07 16:29:20 changed by stewartjohnson

  • keywords set to has_patch.

05/21/07 03:15:30 changed by rob1n

  • version changed from 2.3 to 2.2.1.
  • milestone changed from 2.4 to 2.3.

05/21/07 07:21:26 changed by stewartjohnson

  • keywords changed from has_patch to has-patch.

04/02/08 17:33:47 changed by filosofo

  • status changed from new to closed.
  • resolution set to duplicate.

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

04/02/08 23:20:56 changed by lloydbudd

  • milestone deleted.