Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
|
|
|
|
| 2091 | 2091 | $name = wp_unslash($name); |
| 2092 | 2092 | $description = wp_unslash($description); |
| 2093 | 2093 | |
| 2094 | | if ( empty($slug) ) |
| 2095 | | $slug = sanitize_title($name); |
| | 2094 | if ( empty( $slug ) ) { |
| | 2095 | $name = trim( $name ); |
| | 2096 | $sanitized_name = sanitize_title( $name ); |
| | 2097 | $exists = $wpdb->get_row( $wpdb->prepare( "SELECT term_id, slug FROM $wpdb->terms WHERE name = %s ORDER BY term_id ASC LIMIT 1", $name ) ); |
| | 2098 | if ( ! empty( $exists ) && term_exists( $exists->term_id, $taxonomy ) ) { |
| | 2099 | if ( $sanitized_name === $exists->slug ) |
| | 2100 | return new WP_Error( 'term_exists', __( 'A term with the name provided already exists.' ) ); |
| 2096 | 2101 | |
| | 2102 | $slug = $exists->slug; |
| | 2103 | } elseif ( ! empty( $exists ) ) { |
| | 2104 | $exists = $wpdb->get_var( $wpdb->prepare( "SELECT term_id FROM $wpdb->terms WHERE slug = %s ORDER BY term_id ASC LIMIT 1", $sanitized_name ) ); |
| | 2105 | if ( ! empty( $exists ) ) |
| | 2106 | return new WP_Error( 'term_exists', __( 'A term with the name provided already exists.' ) ); |
| | 2107 | } else { |
| | 2108 | $slug = $sanitized_name; |
| | 2109 | } |
| | 2110 | } |
| | 2111 | |
| 2097 | 2112 | $term_group = 0; |
| 2098 | 2113 | if ( $alias_of ) { |
| 2099 | 2114 | $alias = $wpdb->get_row( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $alias_of) ); |