From 2bb5262cdd7cb3bf7ce44d7ea1a44113c6479bb7 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 8 Apr 2008 01:55:04 +0000 Subject: [PATCH] Move category query to get category case of get_permalink to avoid unnecessary queries. Props mdawaffe. fixes #6638 for trunk git-svn-id: https://develop.svn.wordpress.org/trunk@7626 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 8253c3c4b5..f34d9b5bb2 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -80,13 +80,13 @@ function get_permalink($id = 0, $leavename=false) { $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) ) { - $default_category = get_category( get_option( 'default_category' ) ); - $category = is_wp_error( $default_category)? '' : $default_category->slug; + // show default category in permalinks, without + // having to assign it explicitly + if ( empty($category) ) { + $default_category = get_category( get_option( 'default_category' ) ); + $category = is_wp_error( $default_category ) ? '' : $default_category->slug; + } } $author = '';