Make WordPress Core

Changeset 40292


Ignore:
Timestamp:
03/16/2017 01:34:52 AM (8 years ago)
Author:
boonebgorges
Message:

Streamline get_terms() parameter documentation.

Since 4.6, get_terms() has been a wrapper for WP_Term_Query.
Full parameter documentation lives with the class, and
get_terms() should reference rather than duplicate it.

Props shashwatmittal.
Fixes #37075.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/taxonomy.php

    r40290 r40292  
    10211021 * @global array $wp_filter
    10221022 *
    1023  * @param array|string $args {
    1024  *     Optional. Array or string of arguments to get terms.
    1025  *
    1026  *     @type string|array $taxonomy               Taxonomy name, or array of taxonomies, to which results should
    1027  *                                                be limited.
    1028  *     @type string       $orderby                Field(s) to order terms by. Accepts term fields ('name', 'slug',
    1029  *                                                'term_group', 'term_id', 'id', 'description'), 'count' for term
    1030  *                                                taxonomy count, 'include' to match the 'order' of the $include param,
    1031  *                                                'meta_value', 'meta_value_num', the value of `$meta_key`, the array
    1032  *                                                keys of `$meta_query`, or 'none' to omit the ORDER BY clause.
    1033  *                                                Defaults to 'name'.
    1034  *     @type string       $order                  Whether to order terms in ascending or descending order.
    1035  *                                                Accepts 'ASC' (ascending) or 'DESC' (descending).
    1036  *                                                Default 'ASC'.
    1037  *     @type bool|int     $hide_empty             Whether to hide terms not assigned to any posts. Accepts
    1038  *                                                1|true or 0|false. Default 1|true.
    1039  *     @type array|string $include                Array or comma/space-separated string of term ids to include.
    1040  *                                                Default empty array.
    1041  *     @type array|string $exclude                Array or comma/space-separated string of term ids to exclude.
    1042  *                                                If $include is non-empty, $exclude is ignored.
    1043  *                                                Default empty array.
    1044  *     @type array|string $exclude_tree           Array or comma/space-separated string of term ids to exclude
    1045  *                                                along with all of their descendant terms. If $include is
    1046  *                                                non-empty, $exclude_tree is ignored. Default empty array.
    1047  *     @type int|string   $number                 Maximum number of terms to return. Accepts ''|0 (all) or any
    1048  *                                                positive number. Default ''|0 (all).
    1049  *     @type int          $offset                 The number by which to offset the terms query. Default empty.
    1050  *     @type string       $fields                 Term fields to query for. Accepts 'all' (returns an array of complete
    1051  *                                                term objects), 'ids' (returns an array of ids), 'id=>parent' (returns
    1052  *                                                an associative array with ids as keys, parent term IDs as values),
    1053  *                                                'names' (returns an array of term names), 'count' (returns the number
    1054  *                                                of matching terms), 'id=>name' (returns an associative array with ids
    1055  *                                                as keys, term names as values), or 'id=>slug' (returns an associative
    1056  *                                                array with ids as keys, term slugs as values). Default 'all'.
    1057  *     @type string|array $name                   Optional. Name or array of names to return term(s) for. Default empty.
    1058  *     @type string|array $slug                   Optional. Slug or array of slugs to return term(s) for. Default empty.
    1059  *     @type bool         $hierarchical           Whether to include terms that have non-empty descendants (even
    1060  *                                                if $hide_empty is set to true). Default true.
    1061  *     @type string       $search                 Search criteria to match terms. Will be SQL-formatted with
    1062  *                                                wildcards before and after. Default empty.
    1063  *     @type string       $name__like             Retrieve terms with criteria by which a term is LIKE $name__like.
    1064  *                                                Default empty.
    1065  *     @type string       $description__like      Retrieve terms where the description is LIKE $description__like.
    1066  *                                                Default empty.
    1067  *     @type bool         $pad_counts             Whether to pad the quantity of a term's children in the quantity
    1068  *                                                of each term's "count" object variable. Default false.
    1069  *     @type string       $get                    Whether to return terms regardless of ancestry or whether the terms
    1070  *                                                are empty. Accepts 'all' or empty (disabled). Default empty.
    1071  *     @type int          $child_of               Term ID to retrieve child terms of. If multiple taxonomies
    1072  *                                                are passed, $child_of is ignored. Default 0.
    1073  *     @type int|string   $parent                 Parent term ID to retrieve direct-child terms of. Default empty.
    1074  *     @type bool         $childless              True to limit results to terms that have no children. This parameter
    1075  *                                                has no effect on non-hierarchical taxonomies. Default false.
    1076  *     @type string       $cache_domain           Unique cache key to be produced when this query is stored in an
    1077  *                                                object cache. Default is 'core'.
    1078  *     @type bool         $update_term_meta_cache Whether to prime meta caches for matched terms. Default true.
    1079  *     @type array        $meta_query             Meta query clauses to limit retrieved terms by.
    1080  *                                                See `WP_Meta_Query`. Default empty.
    1081  *     @type string       $meta_key               Limit terms to those matching a specific metadata key. Can be used in
    1082  *                                                conjunction with `$meta_value`. Default empty.
    1083  *     @type string       $meta_value             Limit terms to those matching a specific metadata value. Usually used
    1084  *                                                in conjunction with `$meta_key`. Default empty.
    1085  *     @type string       $meta_type              Type of object metadata is for (e.g., comment, post, or user).
    1086  *                                                Default empty.
    1087  *     @type string       $meta_compare           Comparison operator to test the 'meta_value'. Default empty.
    1088  *     @type bool         $suppress_filter        Whether to suppress the {@see 'get_terms'} filter. Default false.
    1089  * }
    1090  * @param array $deprecated Argument array, when using the legacy function parameter format. If present, this
    1091  *                          parameter will be interpreted as `$args`, and the first function parameter will
    1092  *                          be parsed as a taxonomy or array of taxonomies.
     1023 * @param string|array $args       Optional. Array or string of arguments. See WP_Term_Query::__construct()
     1024 *                                 for information on accepted arguments. Default empty.
     1025 * @param array        $deprecated Argument array, when using the legacy function parameter format. If present, this
     1026 *                                 parameter will be interpreted as `$args`, and the first function parameter will
     1027 *                                 be parsed as a taxonomy or array of taxonomies.
    10931028 * @return array|int|WP_Error List of WP_Term instances and their children. Will return WP_Error, if any of $taxonomies
    10941029 *                            do not exist.
Note: See TracChangeset for help on using the changeset viewer.