WordPress.org

Make WordPress Core

Changeset 5576


Ignore:
Timestamp:
05/28/2007 06:47:08 PM (15 years ago)
Author:
ryan
Message:

Fix category permalinks. Update cat_ID to term_id. fixes #4349 see #4189

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/link-template.php

    r5575 r5576  
    7474        if (strpos($permalink, '%category%') !== false) {
    7575            $cats = get_the_category($post->ID);
    76             $category = $cats[0]->category_nicename;
    77             if ( $parent=$cats[0]->category_parent )
     76            $category = $cats[0]->slug;
     77            if ( $parent=$cats[0]->parent )
    7878                $category = get_category_parents($parent, FALSE, '/', TRUE) . $category;
    7979        }
     
    360360        $join = " INNER JOIN $wpdb->post2cat ON $wpdb->posts.ID= $wpdb->post2cat.post_id ";
    361361        $cat_array = get_the_category($post->ID);
    362         $join .= ' AND (category_id = ' . intval($cat_array[0]->cat_ID);
     362        $join .= ' AND (category_id = ' . intval($cat_array[0]->term_id);
    363363        for ( $i = 1; $i < (count($cat_array)); $i++ ) {
    364             $join .= ' OR category_id = ' . intval($cat_array[$i]->cat_ID);
     364            $join .= ' OR category_id = ' . intval($cat_array[$i]->term_id);
    365365        }
    366366        $join .= ')';
     
    397397        $join = " INNER JOIN $wpdb->post2cat ON $wpdb->posts.ID= $wpdb->post2cat.post_id ";
    398398        $cat_array = get_the_category($post->ID);
    399         $join .= ' AND (category_id = ' . intval($cat_array[0]->cat_ID);
     399        $join .= ' AND (category_id = ' . intval($cat_array[0]->term_id);
    400400        for ( $i = 1; $i < (count($cat_array)); $i++ ) {
    401             $join .= ' OR category_id = ' . intval($cat_array[$i]->cat_ID);
     401            $join .= ' OR category_id = ' . intval($cat_array[$i]->term_id);
    402402        }
    403403        $join .= ')';
Note: See TracChangeset for help on using the changeset viewer.