i'm running my web in english and german using the WPML plugin. my question: when in english mode - is it possible getting the page_title() but in german?


  • 1
    Since this is a premium plugin, it's not likely that you're going to get a great answer here. You might search the WPML documentation here wpml.org/documentation or buy a support license for $30 here: wpml.org/purchase They actually have a pretty reasonable setup there, and would be able to give you much better answers much more quickly. Also: free upgrades! Mar 22 '11 at 13:20
  • I would recommend putting questions and answers here, this is an independent community and you do not have to pay to be able to access the forum. Yes, I am paying customer of WPML, but I have their forum implementation and access policy.
    – sorin
    May 21 '11 at 21:32

Let's say the original language of your site is english, then when visiting a german post you would return the title of the corresponding english post like that :

// Get the post ID of original post
$original_ID = icl_object_id( $post->ID, 'post', false, 'en' );

// Get original post title
$original_title = get_the_title( $original_ID );

Hope that helps, in any case check out the documentation for icl_object_id();


Thanks for that mike23, was a lifesaver for me today. However that exact code didn't work for me, I did have to do some modifications in order to get it to work in my situation which may be due to a newer version of the WPML plugin.

I had to change:

$original_ID = icl_object_id( $post->ID, 'post', false, 'en' );


$original_ID = icl_object_id( $post->ID, 'any', false, 'en' );

Notice that the only change is 'post' -> 'any'. It's a small change but made a world of difference as any other type that I entered would not work for me. Hope this helps someone that runs into the same issue.

PS: I found that the 'any' type could be used by going to the file where that function is created: /wp-content/plugins/sitepress-multilingual-cms/inc/template-functions.php. When in the file search for icl_object_id().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.