IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 21 | 21 | * |
| 22 | 22 | * @type string $taxonomy Taxonomy to retrieve terms for. In this case, default 'category'. |
| 23 | 23 | * } |
| 24 | | * @return array List of categories. |
| | 24 | * @return array|WP_Error List of categories. |
| 25 | 25 | */ |
| 26 | 26 | function get_categories( $args = '' ) { |
| 27 | 27 | $defaults = array( 'taxonomy' => 'category' ); |
| 28 | 28 | $args = wp_parse_args( $args, $defaults ); |
| 29 | 29 | |
| 30 | | $taxonomy = $args['taxonomy']; |
| 31 | | |
| 32 | 30 | /** |
| 33 | 31 | * Filter the taxonomy used to retrieve terms when calling {@see get_categories()}. |
| 34 | 32 | * |
| … |
… |
|
| 37 | 35 | * @param string $taxonomy Taxonomy to retrieve terms from. |
| 38 | 36 | * @param array $args An array of arguments. See {@see get_terms()}. |
| 39 | 37 | */ |
| 40 | | $taxonomy = apply_filters( 'get_categories_taxonomy', $taxonomy, $args ); |
| | 38 | $args['taxonomy'] = apply_filters( 'get_categories_taxonomy', $args['taxonomy'], $args ); |
| 41 | 39 | |
| 42 | 40 | // Back compat |
| 43 | 41 | if ( isset($args['type']) && 'link' == $args['type'] ) { |
| … |
… |
|
| 48 | 46 | '<code>taxonomy => link_category</code>' |
| 49 | 47 | ) |
| 50 | 48 | ); |
| 51 | | $taxonomy = $args['taxonomy'] = 'link_category'; |
| | 49 | |
| | 50 | $args['taxonomy'] = 'link_category'; |
| 52 | 51 | } |
| 53 | 52 | |
| 54 | | $categories = (array) get_terms( $taxonomy, $args ); |
| | 53 | $categories = get_terms( $args ); |
| 55 | 54 | |
| 56 | | foreach ( array_keys( $categories ) as $k ) |
| 57 | | _make_cat_compat( $categories[$k] ); |
| | 55 | if ( ! is_wp_error( $args['taxonomy'] ) ) { |
| | 56 | foreach ( array_keys( $categories ) as $k ) { |
| | 57 | _make_cat_compat( $categories[ $k ] ); |
| | 58 | } |
| | 59 | } |
| 58 | 60 | |
| 59 | 61 | return $categories; |
| 60 | 62 | } |