From 9714b08b71ed8da2b06a574337184a24fbfb4a94 Mon Sep 17 00:00:00 2001 From: ryan 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: http://svn.automattic.com/wordpress/trunk@7626 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 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 = '';