Fix notice

git-svn-id: https://develop.svn.wordpress.org/trunk@9987 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-11-30 19:29:46 +00:00
parent d942a526fe
commit 36f809cde8
1 changed files with 5 additions and 5 deletions

View File

@ -109,12 +109,12 @@ function get_permalink($id = 0, $leavename = false) {
$category = '';
if ( strpos($permalink, '%category%') !== false ) {
$cats = get_the_category($post->ID);
if ( $cats )
if ( $cats ) {
usort($cats, '_usort_terms_by_ID'); // order by ID
$category = $cats[0]->slug;
if ( $parent=$cats[0]->parent )
$category = get_category_parents($parent, false, '/', true) . $category;
$category = $cats[0]->slug;
if ( $parent = $cats[0]->parent )
$category = get_category_parents($parent, false, '/', true) . $category;
}
// show default category in permalinks, without
// having to assign it explicitly
if ( empty($category) ) {