From ac9573bd67a225e51fb7b698b4d507e6ae396f83 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 27 Dec 2022 12:21:35 +0000 Subject: [PATCH] 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 --- src/wp-includes/taxonomy.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php index 2c63e23b27..bd83110e3f 100644 --- a/src/wp-includes/taxonomy.php +++ b/src/wp-includes/taxonomy.php @@ -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.