diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 75873c3ea5..0651e057c4 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -4381,20 +4381,25 @@ function wp_get_split_term( $old_term_id, $taxonomy ) { * Generate a permalink for a taxonomy term archive. * * @since 2.5.0 + * @since 4.3.0 Introduced `$field` argument. * * @param object|int|string $term The term object, ID, or slug whose link will be retrieved. * @param string $taxonomy Optional. Taxonomy. Default empty. + * @param string $field Optional. The term field that should be matched by the `$term` argument. Accepts + * any `$field` values accepted by `get_term_by()`: 'slug', 'name', + * 'term_taxonomy_id', or 'id'. Default is 'slug', unless `$term` is an integer, in + * which case it's asssumed to be an ID. * @return string|WP_Error HTML link to taxonomy term archive on success, WP_Error if term does not exist. */ -function get_term_link( $term, $taxonomy = '' ) { +function get_term_link( $term, $taxonomy = '', $field = null ) { global $wp_rewrite; if ( !is_object($term) ) { - if ( is_int($term) ) { - $term = get_term($term, $taxonomy); - } else { - $term = get_term_by('slug', $term, $taxonomy); + if ( is_null( $field ) ) { + $field = is_int( $term ) ? 'id' : 'slug'; } + + $term = get_term_by( $field, $term, $taxonomy ); } if ( !is_object($term) ) diff --git a/wp-includes/version.php b/wp-includes/version.php index fdc9d83329..23fc7c6be4 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.3-alpha-32552'; +$wp_version = '4.3-alpha-32553'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.