php load specific post id on language 1

php load specific post id on language

// 1- retrieve the right post ID
$my_postid = apply_filters( 'wpml_object_id', 1416 , 'post', false ); //wpml
$my_postid = icl_object_id(1416 , 'post', false ); //polylang @deprecated

$content_post = get_post($my_postid); // 2-use post id

Here is what the above code is Doing:
1. Retrieve the right post ID.
2. Use the post ID to retrieve the post.

Similar Posts