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,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 ) {
|
||||||
|
|
Loading…
Reference in New Issue