WordPress.org

Make WordPress Core

Ticket #15959: get_adjacent_post.patch

File get_adjacent_post.patch, 637 bytes (added by wpdavis, 3 years ago)
  • wp-includes/link-template.php

     
    11101110 
    11111111                if ( $in_same_cat ) { 
    11121112                        $cat_array = wp_get_object_terms($post->ID, 'category', array('fields' => 'ids')); 
    1113                         $join .= " AND tt.taxonomy = 'category' AND tt.term_id IN (" . implode(',', $cat_array) . ")"; 
     1113                        if( !empty( $cat_array ) ) 
     1114                                $join .= " AND tt.taxonomy = 'category' AND tt.term_id IN (" . implode(',', $cat_array) . ")"; 
    11141115                } 
    11151116 
    11161117                $posts_in_ex_cats_sql = "AND tt.taxonomy = 'category'";