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.
Built from https://develop.svn.wordpress.org/trunk@55018


git-svn-id: http://core.svn.wordpress.org/trunk@54551 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-12-27 12:23:15 +00:00
parent 3657c9240d
commit 1e3c221043
2 changed files with 6 additions and 9 deletions

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

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.2-alpha-55017'; $wp_version = '6.2-alpha-55018';
/** /**
* 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.