From 13dade0e8d9e48bb14b8f3d3fbb9b4db3fb29376 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Mon, 28 May 2007 18:47:08 +0000 Subject: [PATCH] Fix category permalinks. Update cat_ID to term_id. fixes #4349 see #4189 git-svn-id: https://develop.svn.wordpress.org/trunk@5576 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/link-template.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index ec1b6ff9a4..2c3912b811 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -73,8 +73,8 @@ function get_permalink($id = 0) { $category = ''; if (strpos($permalink, '%category%') !== false) { $cats = get_the_category($post->ID); - $category = $cats[0]->category_nicename; - if ( $parent=$cats[0]->category_parent ) + $category = $cats[0]->slug; + if ( $parent=$cats[0]->parent ) $category = get_category_parents($parent, FALSE, '/', TRUE) . $category; } @@ -359,9 +359,9 @@ function get_previous_post($in_same_cat = false, $excluded_categories = '') { if ( $in_same_cat ) { $join = " INNER JOIN $wpdb->post2cat ON $wpdb->posts.ID= $wpdb->post2cat.post_id "; $cat_array = get_the_category($post->ID); - $join .= ' AND (category_id = ' . intval($cat_array[0]->cat_ID); + $join .= ' AND (category_id = ' . intval($cat_array[0]->term_id); for ( $i = 1; $i < (count($cat_array)); $i++ ) { - $join .= ' OR category_id = ' . intval($cat_array[$i]->cat_ID); + $join .= ' OR category_id = ' . intval($cat_array[$i]->term_id); } $join .= ')'; } @@ -396,9 +396,9 @@ function get_next_post($in_same_cat = false, $excluded_categories = '') { if ( $in_same_cat ) { $join = " INNER JOIN $wpdb->post2cat ON $wpdb->posts.ID= $wpdb->post2cat.post_id "; $cat_array = get_the_category($post->ID); - $join .= ' AND (category_id = ' . intval($cat_array[0]->cat_ID); + $join .= ' AND (category_id = ' . intval($cat_array[0]->term_id); for ( $i = 1; $i < (count($cat_array)); $i++ ) { - $join .= ' OR category_id = ' . intval($cat_array[$i]->cat_ID); + $join .= ' OR category_id = ' . intval($cat_array[$i]->term_id); } $join .= ')'; }