WPML best page selector with php

I have a multilingual website made with WPML. I have php code to run across pages but I cannot uniquely target the page with is_page(ID) since the ID of the page changes across language domain. I need to write the code to target the page for each language.
What is the best practice to target pages across language domain?

Topic plugin-wpml php Wordpress

Category Web


This code returns the post ID in the current language.

$translated_post_id = apply_filters( 'wpml_object_id', $post_id, 'post' );

So, you can use $translated_post_id in is_page.

Documentation.

 

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.