Skip to content Skip to sidebar

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 2 replies, has 2 voices.

Last updated by Joyce Wever 4 years ago.

Assisted by: Bigul.

Author Posts
April 20, 2022 at 1:46 pm #11056007

Joyce Wever

For a taxonomy page with the same slug it isn't possible to use ACF and edit the correct taxonomy. After looking into the page i found the page isnt using the correct ID for the correct language.

For example, the 3 pages below all have the same name and slug but
it isn't diplay the correct content in the frontend for example the custom field made with ACF
When using the function get_queried_object() this displays the taxonomy-content of the French language on all pages. The postloop is working in the correct language but not the ACF, name and description of the taxonomy.

Also I discoverd that the edit taxonomy button in the WP-adminbar is also linking always to the french version also forexample when displaying a english translated page. (see attachment)

hidden link
hidden link
hidden link

Schermafbeelding 2022-04-20 om 15.44.18 kopie.jpg
Schermafbeelding 2022-04-20 om 15.44.04 kopie.jpg
Schermafbeelding 2022-04-20 om 15.40.42 kopie.jpg
April 20, 2022 at 4:06 pm #11057327

Bigul

Hello,

Welcome to the WPML support forum. I will do my best to help you to resolve the issue.

This may be a compatibility issue. Please use wpml_object_id hook to get the correct ID of the taxonomy in each language. Refer to the following example and this documentation for more details - https://wpml.org/wpml-hook/wpml_object_id/

$tax_id = apply_filters( 'wpml_object_id', $tax_id, 'category' );

Please try it after a site backup and let us know your feedback.

--
Thanks!

Bigul

April 21, 2022 at 7:49 am #11062043

Joyce Wever

Hi Bigul,

Thanks for your reply. Thanks.
the 'wpml_object_id' helped me with getting the correct ID of the taxonomy that i can use within the ACF get_field() in the frontend

The only thing is the edit button in the WP-adminbar thsi keeps loading the wrong language. It is not a big problem for the end user at the moment but still strange that wp is confused about the displayd language