Changeset 8638
- Timestamp:
- 04/15/2019 06:28:20 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-directory-compat.php
r8634 r8638 293 293 // not yet exist as a compat term. 294 294 if ( ! $this->term && $this->get_object( $this->slug() ) ) { 295 $term = wp_insert_term( $this->slug(), $this->taxonomy() ); 295 $term_name = $this->slug(); 296 if ( ! sanitize_title( $term_name ) ) { 297 // This happens when the slug is all non-ascii such as %e5%8f%8b%e8%a8%80, which fails to insert. 298 $term_name = urldecode( $term_name ); 299 } 300 $term = wp_insert_term( $term_name, $this->taxonomy(), array( 'slug' => $this->slug() ) ); 296 301 297 302 // Term exists already? Race-condition, or get_term_by() couldn't find $slug.. 298 303 if ( is_wp_error( $term ) && $term->get_error_data( 'term_exists' ) ) { 299 304 $this->term = get_term( $term->get_error_data( 'term_exists' ) ); 300 } elseif ( isset( $term['term_id'] ) ) {305 } elseif ( ! is_wp_error( $term ) && isset( $term['term_id'] ) ) { 301 306 $this->term = get_term( $term['term_id'] ); 302 307 }
Note: See TracChangeset
for help on using the changeset viewer.