Please make sure to update to WPML 4.3.4 before reporting any issue

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

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));

Relevant Documentation:

This topic contains 5 replies, has 2 voices.

Last updated by andreasH-85 7 months, 1 week ago.

Assigned support staff: Carlos Rojas.

Author Posts
April 10, 2019 at 8:02 pm

andreasH-85

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 Portfolio i used to test the translation:
"/wp-admin/post.php?post=1915&action=edit&lang=de"

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;

April 10, 2019 at 9:12 pm #3581465

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Montevideo (GMT-03:00)

Hello,
Thank you for contacting WPML support.

1.- I will consult our specialists about this issue and I will get back to you as soon as I have an answer.

2.- Please provide the debug information of the site. In this link you will find the steps to follow: https://wpml.org/faq/provide-debug-information-faster-support/

Kind regards,
Carlos

April 11, 2019 at 2:08 pm #3588695

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Montevideo (GMT-03:00)

Hi there,

I consluted 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));

Please let me know if you need further assistance and I will be more than happy to help.
Best regards,
Carlos

April 11, 2019 at 7:52 pm #3592465

andreasH-85

Thank you for your help. This fixed my problem at this point.

I have a second problem on subpage "contact/?lang=en"
This page contains a contact-form-7 form. In the Backend this form is translated (see attached image) and i translated the contact page which contains that form (id 1499) but it is always shown in German.

April 11, 2019 at 8:39 pm #3592819

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Montevideo (GMT-03:00)

Hi there,
I'm glad to hear that the issue is solved 🙂

As the original issue is solved, I kinldy ask you to open a new ticket describing this new issue. This way we will be following the forum's rule of one ticket per issue. This will also help future clients to find solutions to similar problems.

Please don't hesitate to contact us if you need our help in the future with WPML. We will be more than happy to help.
Best regards,
Carlos

April 11, 2019 at 8:56 pm #3592917

andreasH-85

My issue is resolved now. Thank you!