From f547b702015b830ba8f99151dbb21586c50c6345 Mon Sep 17 00:00:00 2001 From: michelvaldrighi Date: Wed, 16 Feb 2005 15:49:02 +0000 Subject: [PATCH] if permalink_structure doesn't have %category%, don't bother querying categories git-svn-id: http://svn.automattic.com/wordpress/trunk@2355 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/template-functions-links.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wp-includes/template-functions-links.php b/wp-includes/template-functions-links.php index 0662dbf00..e547cda1f 100644 --- a/wp-includes/template-functions-links.php +++ b/wp-includes/template-functions-links.php @@ -54,9 +54,12 @@ function get_permalink($id = false) { if ('' != $permalink) { $unixtime = strtotime($idpost->post_date); - $cats = get_the_category($idpost->ID); - $category = $cats[0]->category_nicename; - if ($parent=$cats[0]->category_parent) $category = get_category_parents($parent, FALSE, '/', TRUE) . $category; + $category = ''; + if (strstr($permalink, '%category%')) { + $cats = get_the_category($idpost->ID); + $category = $cats[0]->category_nicename; + if ($parent=$cats[0]->category_parent) $category = get_category_parents($parent, FALSE, '/', TRUE) . $category; + } $authordata = get_userdata($idpost->post_author); $author = $authordata->user_nicename;