acf_get_valid_terms()
acf_get_valid_terms
This function will replace old terms with new split term ids
Хуков нет.
Возвращает
$terms
.
Использование
acf_get_valid_terms( $terms, $taxonomy );
- $terms **
- -
По умолчанию: false - $taxonomy **
- -
По умолчанию: 'category'
Список изменений
С версии 5.1.5 | Введена. |
Код acf_get_valid_terms() acf get valid terms ACF 6.0.4
function acf_get_valid_terms( $terms = false, $taxonomy = 'category' ) { // force into array $terms = acf_get_array( $terms ); // force ints $terms = array_map( 'intval', $terms ); // bail early if function does not yet exist or if ( ! function_exists( 'wp_get_split_term' ) || empty( $terms ) ) { return $terms; } // attempt to find new terms foreach ( $terms as $i => $term_id ) { $new_term_id = wp_get_split_term( $term_id, $taxonomy ); if ( $new_term_id ) { $terms[ $i ] = $new_term_id; } } // return return $terms; }