Add a note about uniqueness to the doc block for `get_term_by()`.
`get_term_by()` always returns a single term, even when more than one term matches the query parameters. The new note warns developers to use `get_terms()` when such ambiguity may result. Fixes #36878. Built from https://develop.svn.wordpress.org/trunk@37656 git-svn-id: http://core.svn.wordpress.org/trunk@37622 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
838156a958
commit
4f264b6d07
|
@ -902,6 +902,13 @@ function get_term( $term, $taxonomy = '', $output = OBJECT, $filter = 'raw' ) {
|
|||
* If $value does not exist, the return value will be false. If $taxonomy exists
|
||||
* and $field and $value combinations exist, the Term will be returned.
|
||||
*
|
||||
* This function will always return the first term that matches the `$field`-
|
||||
* `$value`-`$taxonomy` combination specified in the parameters. If your query
|
||||
* is likely to match more than one term (as is likely to be the case when
|
||||
* `$field` is 'name', for example), consider using get_terms() instead; that
|
||||
* way, you will get all matching terms, and can provide your own logic for
|
||||
* deciding which one was intended.
|
||||
*
|
||||
* @todo Better formatting for DocBlock.
|
||||
*
|
||||
* @since 2.3.0
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.6-alpha-37655';
|
||||
$wp_version = '4.6-alpha-37656';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue