[wp-trac] [WordPress Trac] #41373: Wordpress 4.8 and WPML returns NULL on retrieve of translated slugname. Only ID works

WordPress Trac noreply at wordpress.org
Sat Sep 2 11:35:15 UTC 2017


#41373: Wordpress 4.8 and WPML returns NULL on retrieve of translated slugname.
Only ID works
-------------------------------------------------+-------------------------
 Reporter:  BackuPs                              |       Owner:
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Taxonomy                             |  Review
 Severity:  normal                               |     Version:  4.8
 Keywords:  needs-testing needs-unit-tests       |  Resolution:
  reporter-feedback                              |     Focuses:
-------------------------------------------------+-------------------------

Comment (by SergeyBiryukov):

 Per [https://wpml.org/forums/topic/translated-
 category/page/2/#post-1333854 reply from WPML developers], appears to be a
 regression in [38677]:
 > "So the problem is confirmed and coming from get_term_by() function
 > In WP 4.7 it was a direct SQL
 > {{{
 > $term = $wpdb->get_row( $wpdb->prepare( "SELECT t.*, tt.* FROM
 $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id =
 tt.term_id WHERE $_field = %s", $value ) . " $tax_clause LIMIT 1" );
 > }}}
 > Which means if you pass the slug you will get the ID and WPML will
 convert it later.
 >
 > Now in WP 4.8 it is a tax query
 >
 > {{{
 > switch ( $field ) {
 >         case 'slug' :
 >             $args['slug'] = $value;
 >             break;
 >         case 'name' :
 >             $args['name'] = $value;
 >             break;
 >         case 'term_taxonomy_id' :
 >             $args['term_taxonomy_id'] = $value;
 >             unset( $args[ 'taxonomy' ] );
 >             break;
 >         default :
 >             return false;
 >     }
 >
 >     $terms = get_terms( $args );
 > }}}
 > Which return false. Which mean ID is not converted and results are same
 in both languages."

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41373#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list