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
This commit is contained in:
Ryan Boren 2008-04-08 01:55:04 +00:00
parent 8f9e94e700
commit 2bb5262cdd

View File

@ -80,7 +80,6 @@ function get_permalink($id = 0, $leavename=false) {
$category = $cats[0]->slug; $category = $cats[0]->slug;
if ( $parent=$cats[0]->parent ) if ( $parent=$cats[0]->parent )
$category = get_category_parents($parent, FALSE, '/', TRUE) . $category; $category = get_category_parents($parent, FALSE, '/', TRUE) . $category;
}
// show default category in permalinks, without // show default category in permalinks, without
// having to assign it explicitly // having to assign it explicitly
@ -88,6 +87,7 @@ function get_permalink($id = 0, $leavename=false) {
$default_category = get_category( get_option( 'default_category' ) ); $default_category = get_category( get_option( 'default_category' ) );
$category = is_wp_error( $default_category ) ? '' : $default_category->slug; $category = is_wp_error( $default_category ) ? '' : $default_category->slug;
} }
}
$author = ''; $author = '';
if ( strpos($permalink, '%author%') !== false ) { if ( strpos($permalink, '%author%') !== false ) {