From 0d9ba6cb1a030f8070b98d111a52792d9aebfab4 Mon Sep 17 00:00:00 2001 From: Jb Audras Date: Mon, 10 Oct 2022 12:28:20 +0000 Subject: [PATCH] Docs: Improve `wp_get_object_terms()` return type. Props dd32, audrasjb, desrosj, mukesh27. Fixes #56327. See #55646. git-svn-id: https://develop.svn.wordpress.org/trunk@54441 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/taxonomy.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php index c3153c752a..1dfcf4d9c5 100644 --- a/src/wp-includes/taxonomy.php +++ b/src/wp-includes/taxonomy.php @@ -2180,8 +2180,9 @@ function wp_delete_category( $cat_ID ) { * @param int|int[] $object_ids The ID(s) of the object(s) to retrieve. * @param string|string[] $taxonomies The taxonomy names to retrieve terms from. * @param array|string $args See WP_Term_Query::__construct() for supported arguments. - * @return WP_Term[]|WP_Error Array of terms or empty array if no terms found. - * WP_Error if any of the taxonomies don't exist. + * @return WP_Term[]|int[]|string[]|string|WP_Error Array of terms, a count thereof as a numeric string, + * or WP_Error if any of the taxonomies do not exist. + * See WP_Term_Query::get_terms() for more information. */ function wp_get_object_terms( $object_ids, $taxonomies, $args = array() ) { if ( empty( $object_ids ) || empty( $taxonomies ) ) { @@ -2257,11 +2258,11 @@ function wp_get_object_terms( $object_ids, $taxonomies, $args = array() ) { * * @since 4.2.0 * - * @param WP_Term[] $terms Array of terms for the given object or objects. - * @param int[] $object_ids Array of object IDs for which terms were retrieved. - * @param string[] $taxonomies Array of taxonomy names from which terms were retrieved. - * @param array $args Array of arguments for retrieving terms for the given - * object(s). See wp_get_object_terms() for details. + * @param WP_Term[]|int[]|string[]|string $terms Array of terms or a count thereof as a numeric string. + * @param int[] $object_ids Array of object IDs for which terms were retrieved. + * @param string[] $taxonomies Array of taxonomy names from which terms were retrieved. + * @param array $args Array of arguments for retrieving terms for the given + * object(s). See wp_get_object_terms() for details. */ $terms = apply_filters( 'get_object_terms', $terms, $object_ids, $taxonomies, $args ); @@ -2276,11 +2277,11 @@ function wp_get_object_terms( $object_ids, $taxonomies, $args = array() ) { * * @since 2.8.0 * - * @param WP_Term[] $terms Array of terms for the given object or objects. - * @param string $object_ids Comma separated list of object IDs for which terms were retrieved. - * @param string $taxonomies SQL fragment of taxonomy names from which terms were retrieved. - * @param array $args Array of arguments for retrieving terms for the given - * object(s). See wp_get_object_terms() for details. + * @param WP_Term[]|int[]|string[]|string $terms Array of terms or a count thereof as a numeric string. + * @param string $object_ids Comma separated list of object IDs for which terms were retrieved. + * @param string $taxonomies SQL fragment of taxonomy names from which terms were retrieved. + * @param array $args Array of arguments for retrieving terms for the given + * object(s). See wp_get_object_terms() for details. */ return apply_filters( 'wp_get_object_terms', $terms, $object_ids, $taxonomies, $args ); }