2100 | 2100 | } |
2101 | 2101 | |
2102 | 2102 | $args['name'] = $term; |
2103 | 2103 | $args['taxonomy'] = $taxonomy; |
2104 | 2104 | |
2105 | 2105 | // Coerce null description to strings, to avoid database errors. |
2106 | 2106 | $args['description'] = (string) $args['description']; |
2107 | 2107 | |
2108 | 2108 | $args = sanitize_term($args, $taxonomy, 'db'); |
2109 | 2109 | |
2110 | 2110 | // expected_slashed ($name) |
2111 | 2111 | $name = wp_unslash( $args['name'] ); |
2112 | 2112 | $description = wp_unslash( $args['description'] ); |
2113 | 2113 | $parent = (int) $args['parent']; |
2114 | 2114 | |
2115 | 2119 | $slug_provided = ! empty( $args['slug'] ); |
2116 | 2120 | if ( ! $slug_provided ) { |
2117 | 2121 | $slug = sanitize_title( $name ); |
2118 | 2122 | } else { |
2119 | 2123 | $slug = $args['slug']; |
2120 | 2124 | } |
2121 | 2125 | |
2122 | 2126 | $term_group = 0; |
2123 | 2127 | if ( $args['alias_of'] ) { |
2124 | 2128 | $alias = get_term_by( 'slug', $args['alias_of'], $taxonomy ); |
2125 | 2129 | if ( ! empty( $alias->term_group ) ) { |
2126 | 2130 | // The alias we want is already in a group, so let's use that one. |
2127 | 2131 | $term_group = $alias->term_group; |
2128 | 2132 | } elseif ( ! empty( $alias->term_id ) ) { |
2129 | 2133 | /* |