Skip Navigation

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 3 replies, has 2 voices.

Last updated by Waqas Bin Hasan 1 year, 4 months ago.

Assisted by: Waqas Bin Hasan.

Author Posts
December 12, 2022 at 5:35 pm #12637155

matthieuJ

Hello,

I use <?php the_category( ', ' ); ?> for display the category of my article.
But I have all category of all lang. I can just show for my lang ?

thank you

Notification_Center.png
December 14, 2022 at 12:14 pm #12649445

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting the support.

Looks like you need to get the current language of the post/page and/or taxonomy, please consult with following guides:

- https://wpml.org/documentation/support/creating-multilingual-wordpress-themes/language-dependent-ids/
- https://wpml.org/wpml-hook/wpml_object_id/
- https://wpml.org/wpml-hook/wpml_current_language/
- https://wpml.org/faq/how-to-get-other-languages-of-current-post/
- https://wpml.org/faq/how-to-get-current-language-with-wpml/

For a detailed information on available hooks (actions/filters), please see https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference/.

Regards.

December 14, 2022 at 3:02 pm #12651001

matthieuJ

Thanks for the info, lots of links. I have to apply a filter on the_category right?

I tried several variables but nothing happens, I must be doing it wrong for the category of my posts

December 15, 2022 at 8:55 am #12655477

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Have you checked https://wpml.org/wpml-hook/wpml_object_id/ for examples provided in this article?

The basic idea is to get categories IDs of your post (or article), then fetch their translations, as shown in the above mentioned.

See followings on how to get categories IDs:

- https://developer.wordpress.org/reference/functions/get_the_category/
- https://developer.wordpress.org/reference/functions/wp_get_post_categories/

Regards.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.