Changeset 32827
- Timestamp:
- 06/17/2015 11:12:08 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-press-this.php
r32800 r32827 202 202 } 203 203 204 // @todo Find a more performant to check existence, maybe get_term() with a separate parent check. 205 if ( ! $cat_id = term_exists( $cat_name, $taxonomy->name, $parent ) ) { 206 $cat_id = wp_insert_term( $cat_name, $taxonomy->name, array( 'parent' => $parent ) ); 207 } 204 // @todo Find a more performant way to check existence, maybe get_term() with a separate parent check. 205 if ( term_exists( $cat_name, $taxonomy->name, $parent ) ) { 206 if ( count( $names ) === 1 ) { 207 wp_send_json_error( array( 'errorMessage' => __( 'This category already exists.' ) ) ); 208 } else { 209 continue; 210 } 211 } 212 213 $cat_id = wp_insert_term( $cat_name, $taxonomy->name, array( 'parent' => $parent ) ); 208 214 209 215 if ( is_wp_error( $cat_id ) ) {
Note: See TracChangeset
for help on using the changeset viewer.