| @@ -137,21 +137,24 @@ | ||
| 137 | 137 | * @return string |
| 138 | 138 | */ |
| 139 | 139 | |
| 140 | 140 | function acf_get_term_title( $term ) { |
| 141 | + | |
| 142 | + // set to term name | |
| 141 | 143 | $title = $term->name; |
| 142 | 144 | |
| 143 | - // Allow for empty name. | |
| 145 | + // allow for empty name | |
| 144 | 146 | if( $title === '' ) { |
| 145 | 147 | $title = __('(no title)', 'acf'); |
| 146 | 148 | } |
| 147 | 149 | |
| 148 | - // Prepend ancestors indentation. | |
| 150 | + // prepent ancestors indentation | |
| 149 | 151 | if( is_taxonomy_hierarchical($term->taxonomy) ) { |
| 150 | 152 | $ancestors = get_ancestors( $term->term_id, $term->taxonomy ); |
| 151 | 153 | $title = str_repeat('- ', count($ancestors)) . $title; |
| 152 | 154 | } |
| 153 | 155 | |
| 156 | + // return | |
| 154 | 157 | return $title; |
| 155 | 158 | } |
| 156 | 159 | |
| 157 | 160 | /** |
| @@ -355,9 +358,12 @@ | ||
| 355 | 358 | */ |
| 356 | 359 | function acf_decode_term( $string ) { |
| 357 | 360 | if( is_string($string) && strpos($string, ':') ) { |
| 358 | 361 | list( $taxonomy, $slug ) = explode(':', $string); |
| 359 | - return compact( 'taxonomy', 'slug' ); | |
| 362 | + return array( | |
| 363 | + 'taxonomy' => $taxonomy, | |
| 364 | + 'slug' => $slug | |
| 365 | + ); | |
| 360 | 366 | } |
| 361 | 367 | return false; |
| 362 | 368 | } |
| 363 | 369 | |
| @@ -489,20 +495,7 @@ | ||
| 489 | 495 | 'text' => $text |
| 490 | 496 | ); |
| 491 | 497 | } |
| 492 | 498 | |
| 493 | -/** | |
| 494 | - * Returns a valid post_id string for a given term and taxonomy. | |
| 495 | - * No longer needed since WP introduced the termmeta table in WP 4.4. | |
| 496 | - * | |
| 497 | - * @date 6/2/17 | |
| 498 | - * @since 5.5.6 | |
| 499 | - * @deprecated 5.9.2 | |
| 500 | - * | |
| 501 | - * @param $taxonomy (string) The taxonomy type. | |
| 502 | - * @param $term_id (int) The term ID. | |
| 503 | - * @return (string) | |
| 504 | - */ | |
| 505 | -function acf_get_term_post_id( $taxonomy, $term_id ) { | |
| 506 | - _deprecated_function( __FUNCTION__, '5.9.2', 'string format term_%d' ); | |
| 507 | - return 'term_' . $term_id; | |
| 508 | -} | |
| 499 | + | |
| 500 | + | |
| 501 | +?> | |