From e0c7c93fa0c0853f14b711297d4be788d250bbfd Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Tue, 7 Sep 2010 04:29:00 +0000 Subject: [PATCH] Make the second (taxonomy) parameter for get_term_link() optional if you pass in a term object as the first argument (which has the taxonomy in it). fixes #13081. props scribu git-svn-id: https://develop.svn.wordpress.org/trunk@15586 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/classes.php | 4 ++-- wp-includes/taxonomy.php | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/wp-includes/classes.php b/wp-includes/classes.php index f24a6ec289..03770586af 100644 --- a/wp-includes/classes.php +++ b/wp-includes/classes.php @@ -1340,9 +1340,9 @@ class Walker_Category extends Walker { function start_el(&$output, $category, $depth, $args) { extract($args); - $cat_name = esc_attr( $category->name); + $cat_name = esc_attr( $category->name ); $cat_name = apply_filters( 'list_cats', $cat_name, $category ); - $link = 'description) ) $link .= 'title="' . sprintf(__( 'View all posts filed under %s' ), $cat_name) . '"'; else diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index c34269724a..e41bc6aea5 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -2481,10 +2481,10 @@ function _update_post_term_count( $terms, $taxonomy ) { * @since 2.5.0 * * @param object|int|string $term - * @param string $taxonomy + * @param string $taxonomy (optional if $term is object) * @return string HTML link to taxonomy term archive */ -function get_term_link( $term, $taxonomy ) { +function get_term_link( $term, $taxonomy = '') { global $wp_rewrite; if ( !is_object($term) ) { @@ -2501,6 +2501,8 @@ function get_term_link( $term, $taxonomy ) { if ( is_wp_error( $term ) ) return $term; + $taxonomy = $term->taxonomy; + // use legacy functions for core taxonomies until they are fully plugged in if ( $taxonomy == 'category' ) return get_category_link((int) $term->term_id); @@ -2597,7 +2599,7 @@ function get_the_taxonomies($post = 0) { $links = array(); foreach ( $terms as $term ) - $links[] = "$term->name"; + $links[] = "$term->name"; if ( $links ) $taxonomies[$taxonomy] = wp_sprintf($t['template'], $t['label'], $links, $terms);