Docs: Remove the legacy example of passing a taxonomy to get_terms().

As of WordPress 4.5, taxonomies should be passed to `get_terms()` via the `taxonomy` argument in the `$args` array:
{{{
$terms = get_terms( array(
    'taxonomy'   => 'post_tag',
    'hide_empty' => false,
) );
}}}

The legacy way of passing a taxonomy via the function's first parameter was still mentioned in the documentation, causing some confusion.

This commit updates the function documentation to better highlight the currently recommended approach.

Follow-up to [36614].

Props ramon-fincken, sabernhardt, SergeyBiryukov.
Fixes #57380.

git-svn-id: https://develop.svn.wordpress.org/trunk@55018 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2022-12-27 12:21:35 +00:00
parent a32075429f
commit ac9573bd67

View File

@ -1229,19 +1229,16 @@ function get_term_to_edit( $id, $taxonomy ) {
* The {@see 'get_terms_orderby'} filter passes the `ORDER BY` clause for the query
* along with the $args array.
*
* Prior to 4.5.0, the first parameter of `get_terms()` was a taxonomy or list of taxonomies:
*
* $terms = get_terms( 'post_tag', array(
* 'hide_empty' => false,
* ) );
*
* Since 4.5.0, taxonomies should be passed via the 'taxonomy' argument in the `$args` array:
* Taxonomy or an array of taxonomies should be passed via the 'taxonomy' argument
* in the `$args` array:
*
* $terms = get_terms( array(
* 'taxonomy' => 'post_tag',
* 'taxonomy' => 'post_tag',
* 'hide_empty' => false,
* ) );
*
* Prior to 4.5.0, taxonomy was passed as the first parameter of `get_terms()`.
*
* @since 2.3.0
* @since 4.2.0 Introduced 'name' and 'childless' parameters.
* @since 4.4.0 Introduced the ability to pass 'term_id' as an alias of 'id' for the `orderby` parameter.