Don't allow `$field` param to be passed to `get_term_link()`.

The new parameter creates inconsistencies in the signatures of the various
functions for fetching term links (`get_term_feed_link()`,
`get_edit_term_link()`, etc.).

Reverts [32553].

See #14156.
Built from https://develop.svn.wordpress.org/trunk@33022


git-svn-id: http://core.svn.wordpress.org/trunk@32993 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2015-07-01 12:54:25 +00:00
parent ca390b2fb5
commit b1bd2e699d
2 changed files with 6 additions and 11 deletions

View File

@ -4437,27 +4437,22 @@ function wp_get_split_term( $old_term_id, $taxonomy ) {
* Generate a permalink for a taxonomy term archive. * Generate a permalink for a taxonomy term archive.
* *
* @since 2.5.0 * @since 2.5.0
* @since 4.3.0 Introduced `$field` argument.
* *
* @global WP_Rewrite $wp_rewrite * @global WP_Rewrite $wp_rewrite
* *
* @param object|int|string $term The term object, ID, or slug whose link will be retrieved. * @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 $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. * @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 = '', $field = null ) { function get_term_link( $term, $taxonomy = '' ) {
global $wp_rewrite; global $wp_rewrite;
if ( !is_object($term) ) { if ( !is_object($term) ) {
if ( is_null( $field ) ) { if ( is_int( $term ) ) {
$field = is_int( $term ) ? 'id' : 'slug'; $term = get_term( $term, $taxonomy );
} else {
$term = get_term_by( 'slug', $term, $taxonomy );
} }
$term = get_term_by( $field, $term, $taxonomy );
} }
if ( !is_object($term) ) if ( !is_object($term) )

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.3-alpha-33021'; $wp_version = '4.3-alpha-33022';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.