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 thread is resolved. Here is a description of the problem and solution.
Problem: I am trying to translate the caption and description of some images. In the media translation and post translation page everything looks fine. If i open the page "/portfolio-posts/zbi-1611/?lang=en" I always get the German text.
This is the way I load the data caption and description in PHP:
$image_media_caption = wp_get_attachment_caption($image_id); $image_media_description = get_post( $image_id )->post_content;
Solution: I consulted our specialists and the cause of the issue might be that you aren't using our filters to translate the post ID that is being passed to the function.
For example: wp_get_attachment_caption(apply_filters( 'wpml_object_id', $post_id_here, 'attachment', TRUE));