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
This commit is contained in:
Sergey Biryukov 2020-07-24 12:02:47 +00:00
parent 6b24e352a0
commit fc1e77f42b

View File

@ -2138,7 +2138,7 @@ function wp_get_object_terms( $object_ids, $taxonomies, $args = array() ) {
* 3. The 'term_id_filter' is evaluated. * 3. The 'term_id_filter' is evaluated.
* 4. The term cache is cleaned. * 4. The term cache is cleaned.
* 5. Several more actions are fired. * 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 * 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 * 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. * the term is inserted and the term_id will be given.
* *
* Error handling: * 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. * a WP_Error object will be returned.
* *
* If the term already exists on the same hierarchical level, * 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 * @since 2.3.0
* *
* @param int $term_id Term ID. * @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 ); $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. * 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 * 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). * update will fail (or perhaps create a new term, neither would be acceptable).
* *
* Defaults will set 'alias_of', 'description', 'parent', and 'slug' if not * 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 * 'alias_of' will create a term group, if it doesn't already exist, and
* it for the $term. * update it for the `$term`.
* *
* If the 'slug' argument in $args is missing, then the 'name' in $args will be * If the 'slug' argument in `$args` is missing, then the 'name' will be used.
* used. It should also be noted that if you set 'slug' and it isn't unique then * If you set 'slug' and it isn't unique, then a WP_Error is returned.
* a WP_Error will be passed back. If you don't pass any slug, then a unique one * If you don't pass any slug, then a unique one will be created.
* 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.
* *
* @since 2.3.0 * @since 2.3.0
* *
* @global wpdb $wpdb WordPress database abstraction object. * @global wpdb $wpdb WordPress database abstraction object.
* *
* @param int $term_id The ID of the term * @param int $term_id The ID of the term.
* @param string $taxonomy The context in which to relate the term to the object. * @param string $taxonomy The taxonomy of the term.
* @param array|string $args Optional. Array of get_terms() arguments. Default empty array. * @param array|string $args {
* @return array|WP_Error Returns Term ID and Taxonomy Term ID * 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() ) { function wp_update_term( $term_id, $taxonomy, $args = array() ) {
global $wpdb; global $wpdb;