[wp-trac] [WordPress Trac] #4304: get_next_post/get_previous_post category exclusions still broken

WordPress Trac wp-trac at lists.automattic.com
Sun May 20 16:07:40 GMT 2007

#4304: get_next_post/get_previous_post category exclusions still broken
 Reporter:  stewartjohnson  |       Owner:  anonymous
     Type:  defect          |      Status:  new      
 Priority:  normal          |   Milestone:  2.4      
Component:  Template        |     Version:  2.3      
 Severity:  normal          |    Keywords:           
 This was broken up until version 2.1 (see the history of it at
 fix-category-exclusions-in-next_post_linkprevious_post_link/ RonR]'s

 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.

Ticket URL: <http://trac.wordpress.org/ticket/4304>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list