Changeset 33022 for trunk/src/wp-includes/taxonomy.php
- Timestamp:
- 07/01/2015 12:53:05 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/taxonomy.php
r32933 r33022 4438 4438 * 4439 4439 * @since 2.5.0 4440 * @since 4.3.0 Introduced `$field` argument.4441 4440 * 4442 4441 * @global WP_Rewrite $wp_rewrite … … 4444 4443 * @param object|int|string $term The term object, ID, or slug whose link will be retrieved. 4445 4444 * @param string $taxonomy Optional. Taxonomy. Default empty. 4446 * @param string $field Optional. The term field that should be matched by the `$term` argument. Accepts4447 * any `$field` values accepted by `get_term_by()`: 'slug', 'name',4448 * 'term_taxonomy_id', or 'id'. Default is 'slug', unless `$term` is an integer, in4449 * which case it's asssumed to be an ID.4450 4445 * @return string|WP_Error HTML link to taxonomy term archive on success, WP_Error if term does not exist. 4451 4446 */ 4452 function get_term_link( $term, $taxonomy = '' , $field = null) {4447 function get_term_link( $term, $taxonomy = '' ) { 4453 4448 global $wp_rewrite; 4454 4449 4455 4450 if ( !is_object($term) ) { 4456 if ( is_ null( $field) ) {4457 $ field = is_int( $term ) ? 'id' : 'slug';4458 } 4459 4460 $term = get_term_by( $field, $term, $taxonomy );4451 if ( is_int( $term ) ) { 4452 $term = get_term( $term, $taxonomy ); 4453 } else { 4454 $term = get_term_by( 'slug', $term, $taxonomy ); 4455 } 4461 4456 } 4462 4457
Note: See TracChangeset
for help on using the changeset viewer.