Make WordPress Core

Ticket #37075: 37075.patch

File 37075.patch, 7.8 KB (added by shashwatmittal, 7 years ago)

Added all the relevant arguments in the documentation and pointed it to WP_Term_Query::construct()

  • taxonomy.php

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

    176176         *                                                Can be used in conjunction with `$meta_value`.
    177177         *     @type string       $meta_value             Limit terms to those matching a specific metadata value.
    178178         *                                                Usually used in conjunction with `$meta_key`.
     179         *         @type string           $meta_type                      Type of object metadata is for (e.g., comment, post, or user).
     180         *         @type string       $meta_compare                       Comparison operator to test the 'meta_value'.
    179181         * }
    180182         */
    181183        public function __construct( $query = '' ) {