From fc1e77f42bb06539fd0ce8a135adf0d22ad3f477 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 24 Jul 2020 12:02:47 +0000 Subject: [PATCH] Docs: Correct some documentation for `wp_update_term()`. See #49572. git-svn-id: https://develop.svn.wordpress.org/trunk@48599 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/taxonomy.php | 41 ++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php index c75d60c6c7..40cc49d56e 100644 --- a/src/wp-includes/taxonomy.php +++ b/src/wp-includes/taxonomy.php @@ -2138,7 +2138,7 @@ function wp_get_object_terms( $object_ids, $taxonomies, $args = array() ) { * 3. The 'term_id_filter' is evaluated. * 4. The term cache is cleaned. * 5. Several more actions are fired. - * 6. An array is returned containing the term_id and term_taxonomy_id. + * 6. An array is returned containing the `term_id` and `term_taxonomy_id`. * * If the 'slug' argument is not empty, then it is checked to see if the term * is invalid. If it is not a valid, existing term, it is added and the term_id @@ -2148,7 +2148,7 @@ function wp_get_object_terms( $object_ids, $taxonomies, $args = array() ) { * the term is inserted and the term_id will be given. * * Error handling: - * If $taxonomy does not exist or $term is empty, + * If `$taxonomy` does not exist or `$term` is empty, * a WP_Error object will be returned. * * If the term already exists on the same hierarchical level, @@ -2430,7 +2430,7 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) { * @since 2.3.0 * * @param int $term_id Term ID. - * @param int $tt_id Taxonomy term ID. + * @param int $tt_id Term taxonomy ID. */ $term_id = apply_filters( 'term_id_filter', $term_id, $tt_id ); @@ -2883,32 +2883,37 @@ function wp_unique_term_slug( $slug, $term ) { /** * Update term based on arguments provided. * - * The $args will indiscriminately override all values with the same field name. + * The `$args` will indiscriminately override all values with the same field name. * Care must be taken to not override important information need to update or * update will fail (or perhaps create a new term, neither would be acceptable). * * Defaults will set 'alias_of', 'description', 'parent', and 'slug' if not - * defined in $args already. + * defined in `$args` already. * - * 'alias_of' will create a term group, if it doesn't already exist, and update - * it for the $term. + * 'alias_of' will create a term group, if it doesn't already exist, and + * update it for the `$term`. * - * If the 'slug' argument in $args is missing, then the 'name' in $args will be - * used. It should also be noted that if you set 'slug' and it isn't unique then - * a WP_Error will be passed back. If you don't pass any slug, then a unique one - * will be created for you. - * - * For what can be overrode in `$args`, check the term scheme can contain and stay - * away from the term keys. + * If the 'slug' argument in `$args` is missing, then the 'name' will be used. + * If you set 'slug' and it isn't unique, then a WP_Error is returned. + * If you don't pass any slug, then a unique one will be created. * * @since 2.3.0 * * @global wpdb $wpdb WordPress database abstraction object. * - * @param int $term_id The ID of the term - * @param string $taxonomy The context in which to relate the term to the object. - * @param array|string $args Optional. Array of get_terms() arguments. Default empty array. - * @return array|WP_Error Returns Term ID and Taxonomy Term ID + * @param int $term_id The ID of the term. + * @param string $taxonomy The taxonomy of the term. + * @param array|string $args { + * Optional. Array or string of arguments for updating a term. + * + * @type string $alias_of Slug of the term to make this term an alias of. + * Default empty string. Accepts a term slug. + * @type string $description The term description. Default empty string. + * @type int $parent The id of the parent term. Default 0. + * @type string $slug The term slug to use. Default empty string. + * } + * @return array|WP_Error An array containing the `term_id` and `term_taxonomy_id`, + * WP_Error otherwise. */ function wp_update_term( $term_id, $taxonomy, $args = array() ) { global $wpdb;