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
This commit is contained in:
parent
9ffa66c56c
commit
9714b08b71
|
@ -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;
|
||||
$category = is_wp_error( $default_category ) ? '' : $default_category->slug;
|
||||
}
|
||||
}
|
||||
|
||||
$author = '';
|
||||
|
|
Loading…
Reference in New Issue