[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
Wed Aug 2 22:57:42 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 BackuPs):

 Hi John,

 Thanks for the reply.

 I reported this to wpml, https://wpml.org/forums/topic/translated-
 category/ they confirmed the bug. Further testing learned that it happens
 in any multilanguage plugin so it must be a wp issue.

 It also happens in polylang.

 Create a category and a translated category. Create a post and assign it
 to the category. Create a translated post and make sure its assigned to
 the translated category. In wpml this is done automically.

 Then if you would add this code to the archive.php or single post.php you
 will see the term id in the original default language. But in the
 translated page it is empty or null.

 <?php
 $term_slug='gallery';
 $term_data = get_term_by( 'slug', $term_slug, 'category' );
 $term_id = (int) $term_data->term_id;
 echo 'term-id :'.$term_id;

 I will ask WPML to hook into this.

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


More information about the wp-trac mailing list