From 6621b8eed0826ad3c3abe0dc2b0794fe9de1243f Mon Sep 17 00:00:00 2001 From: ryan 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: http://svn.automattic.com/wordpress/trunk@5576 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- 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 ec1b6ff9a..2c3912b81 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 .= ')'; }