@@ 2278-2294 (lines=17) @@ | ||
2275 | } |
|
2276 | ||
2277 | $term_group = 0; |
|
2278 | if ( $args['alias_of'] ) { |
|
2279 | $alias = get_term_by( 'slug', $args['alias_of'], $taxonomy ); |
|
2280 | if ( ! empty( $alias->term_group ) ) { |
|
2281 | // The alias we want is already in a group, so let's use that one. |
|
2282 | $term_group = $alias->term_group; |
|
2283 | } elseif ( ! empty( $alias->term_id ) ) { |
|
2284 | /* |
|
2285 | * The alias is not in a group, so we create a new one |
|
2286 | * and add the alias to it. |
|
2287 | */ |
|
2288 | $term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms") + 1; |
|
2289 | ||
2290 | wp_update_term( $alias->term_id, $taxonomy, array( |
|
2291 | 'term_group' => $term_group, |
|
2292 | ) ); |
|
2293 | } |
|
2294 | } |
|
2295 | ||
2296 | /* |
|
2297 | * Prevent the creation of terms with duplicate names at the same level of a taxonomy hierarchy, |
|
@@ 2867-2885 (lines=19) @@ | ||
2864 | $parsed_args['slug'] = $slug; |
|
2865 | ||
2866 | $term_group = isset( $parsed_args['term_group'] ) ? $parsed_args['term_group'] : 0; |
|
2867 | if ( $args['alias_of'] ) { |
|
2868 | $alias = get_term_by( 'slug', $args['alias_of'], $taxonomy ); |
|
2869 | if ( ! empty( $alias->term_group ) ) { |
|
2870 | // The alias we want is already in a group, so let's use that one. |
|
2871 | $term_group = $alias->term_group; |
|
2872 | } elseif ( ! empty( $alias->term_id ) ) { |
|
2873 | /* |
|
2874 | * The alias is not in a group, so we create a new one |
|
2875 | * and add the alias to it. |
|
2876 | */ |
|
2877 | $term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms") + 1; |
|
2878 | ||
2879 | wp_update_term( $alias->term_id, $taxonomy, array( |
|
2880 | 'term_group' => $term_group, |
|
2881 | ) ); |
|
2882 | } |
|
2883 | ||
2884 | $parsed_args['term_group'] = $term_group; |
|
2885 | } |
|
2886 | ||
2887 | /** |
|
2888 | * Filters the term parent. |