WordPress.org

Make WordPress Core

Changeset 29128


Ignore:
Timestamp:
07/13/2014 04:14:39 AM (8 years ago)
Author:
DrewAPicture
Message:

Convert default arguments documentation for get_terms() into a hash notation.

See #28841.

File:
1 edited

Legend:

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

    r29119 r29128  
    12121212 * along with the $args array.
    12131213 *
    1214  * The list of arguments that $args can contain, which will overwrite the defaults:
    1215  *
    1216  * orderby - Default is 'name'. Can be name, count, term_group, slug or nothing
    1217  * (will use term_id), Passing a custom value other than these will cause it to
    1218  * order based on the custom value.
    1219  *
    1220  * order - Default is ASC. Can use DESC.
    1221  *
    1222  * hide_empty - Default is true. Will not return empty terms, which means
    1223  * terms whose count is 0 according to the given taxonomy.
    1224  *
    1225  * exclude - Default is an empty array. An array, comma- or space-delimited string
    1226  * of term ids to exclude from the return array. If 'include' is non-empty,
    1227  * 'exclude' is ignored.
    1228  *
    1229  * exclude_tree - Default is an empty array. An array, comma- or space-delimited
    1230  * string of term ids to exclude from the return array, along with all of their
    1231  * descendant terms according to the primary taxonomy. If 'include' is non-empty,
    1232  * 'exclude_tree' is ignored.
    1233  *
    1234  * include - Default is an empty array. An array, comma- or space-delimited string
    1235  * of term ids to include in the return array.
    1236  *
    1237  * number - The maximum number of terms to return. Default is to return them all.
    1238  *
    1239  * offset - The number by which to offset the terms query.
    1240  *
    1241  * fields - Default is 'all', which returns an array of term objects.
    1242  * If 'fields' is 'ids' or 'names', returns an array of
    1243  * integers or strings, respectively.
    1244  *
    1245  * slug - Returns terms whose "slug" matches this value. Default is empty string.
    1246  *
    1247  * hierarchical - Whether to include terms that have non-empty descendants
    1248  * (even if 'hide_empty' is set to true).
    1249  *
    1250  * search - Returned terms' names will contain the value of 'search',
    1251  * case-insensitive. Default is an empty string.
    1252  *
    1253  * name__like - Returned terms' names will contain the value of 'name__like',
    1254  * case-insensitive. Default is empty string.
    1255  *
    1256  * description__like - Returned terms' descriptions will contain the value of
    1257  *  'description__like', case-insensitive. Default is empty string.
    1258  *
    1259  * The argument 'pad_counts', if set to true will include the quantity of a term's
    1260  * children in the quantity of each term's "count" object variable.
    1261  *
    1262  * The 'get' argument, if set to 'all' instead of its default empty string,
    1263  * returns terms regardless of ancestry or whether the terms are empty.
    1264  *
    1265  * The 'child_of' argument, when used, should be set to the integer of a term ID. Its default
    1266  * is 0. If set to a non-zero value, all returned terms will be descendants
    1267  * of that term according to the given taxonomy. Hence 'child_of' is set to 0
    1268  * if more than one taxonomy is passed in $taxonomies, because multiple taxonomies
    1269  * make term ancestry ambiguous.
    1270  *
    1271  * The 'parent' argument, when used, should be set to the integer of a term ID. Its default is
    1272  * the empty string '', which has a different meaning from the integer 0.
    1273  * If set to an integer value, all returned terms will have as an immediate
    1274  * ancestor the term whose ID is specified by that integer according to the given taxonomy.
    1275  * The 'parent' argument is different from 'child_of' in that a term X is considered a 'parent'
    1276  * of term Y only if term X is the father of term Y, not its grandfather or great-grandfather, etc.
    1277  *
    1278  * The 'cache_domain' argument enables a unique cache key to be produced when this query is stored
    1279  * in object cache. For instance, if you are using one of this function's filters to modify the
    1280  * query (such as 'terms_clauses'), setting 'cache_domain' to a unique value will not overwrite
    1281  * the cache for similar queries. Default value is 'core'.
    1282  *
    12831214 * @since 2.3.0
    12841215 *
    1285  * @uses $wpdb
    1286  * @uses wp_parse_args() Merges the defaults with those defined by $args and allows for strings.
    1287  *
    1288  * @param string|array $taxonomies Taxonomy name or list of Taxonomy names
    1289  * @param string|array $args The values of what to search for when returning terms
    1290  * @return array|WP_Error List of Term Objects and their children. Will return WP_Error, if any of $taxonomies do not exist.
     1216 * @global wpdb $wpdb WordPress database access abstraction object.
     1217 *
     1218 * @param string|array $taxonomies Taxonomy name or list of Taxonomy names.
     1219 * @param array|string $args {
     1220 *     Optional. Array or string of arguments to get terms.
     1221 *
     1222 * @type string   $orderby               Field(s) to order terms by. Accepts term fields, though
     1223 *                                       empty defaults to 'term_id'. Default 'name'.
     1224 * @type string   $order                 Whether to order terms in ascending or descending order.
     1225 *                                       Accepts 'ASC' (ascending) or 'DESC' (descending).
     1226 *                                       Default 'ASC'.
     1227 * @type bool|int     $hide_empty        Whether to hide terms not assigned to any posts. Accepts
     1228 *                                       1|true or 0|false. Default 1|true.
     1229 * @type array|string $include           Array or comma/space-separated string of term ids to include.
     1230 *                                       Default empty array.
     1231 * @type array|string $exclude           Array or comma/space-separated string of term ids to exclude.
     1232 *                                       If $include is non-empty, $exclude is ignored.
     1233 *                                       Default empty array.
     1234 * @type array|string $exclude_tree      Array or comma/space-separated string of term ids to exclude
     1235 *                                       along with all of their descendant terms. If $include is
     1236 *                                       non-empty, $exclude_tree is ignored. Default empty array.
     1237 * @type int          $number            Maximum number of terms to return. Accepts 1+ or -1 (all).
     1238 *                                       Default -1.
     1239 * @type int          $offset            The number by which to offset the terms query. Default empty.
     1240 * @type string       $fields            Term fields to query for. Accepts 'all' (returns an array of
     1241 *                                       term objects), 'ids' or 'names' (returns an array of integers
     1242 *                                       or strings, respectively. Default 'all'.
     1243 * @type string       $slug              Slug to return term(s) for. Default empty.
     1244 * @type bool         $hierarchical      Whether to include terms that have non-empty descendants (even
     1245 *                                       if $hide_empty is set to true). Default true.
     1246 * @type string       $search            Search criteria to match terms. Will be SQL-formatted with
     1247 *                                       wildcards before and after. Default empty.
     1248 * @type string       $name__like        Retrieve terms with criteria by which a term is LIKE $name__like.
     1249 *                                       Default empty.
     1250 * @type string       $description__like Retrieve terms where the description is LIKE $description__like.
     1251 *                                       Default empty.
     1252 * @type bool         $pad_counts        Whether to pad the quantity of a term's children in the quantity
     1253 *                                       of each term's "count" object variable. Default false.
     1254 * @type string       $get               Whether to return terms regardless of ancestry or whether the terms
     1255 *                                       are empty. Accepts 'all' or empty (disabled). Default empty.
     1256 * @type int          $child_of          Term ID to retrieve child terms of. If multiple taxonomies
     1257 *                                       are passed, $child_of is ignored. Default 0.
     1258 * @type int|string   $parent            Parent term ID to retrieve direct-child terms of. Default empty.
     1259 * @type string       $cache_domain      Unique cache key to be produced when this query is stored in an
     1260 *                                       object cache. Default is 'core'.
     1261 * }
     1262 * @return array|WP_Error List of Term Objects and their children. Will return WP_Error, if any of $taxonomies
     1263 *                        do not exist.
    12911264 */
    12921265function get_terms( $taxonomies, $args = '' ) {
Note: See TracChangeset for help on using the changeset viewer.