Skip Navigation

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.

Our next available supporter will start replying to tickets in about 7.95 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - -
- - - - - - -

Supporter timezone: Asia/Yerevan (GMT+04:00)

Tagged: 

This topic contains 14 replies, has 2 voices.

Last updated by Christopher Amirian 2 months, 2 weeks ago.

Assisted by: Christopher Amirian.

Author Posts
June 18, 2024 at 8:43 pm #15750898

daveR-5

Background of the issue:
The Dynamic Preview from ACF Extended plugin isn't working with WPML when on a non-primary language : it always shows an empty preview. When modifying a page in my primary WordPress language (in my case French), the problem doesn't occur.

Also, strangely, the problem only occurs while the Advanced Custom Fields Multilingual plugin is activated.

I believe this same problem was reported (by someone else) 2 years ago : https://wordpress.org/support/topic/dynamic-preview-not-working-on-wpml-non-primary-language/
However, it was never fully resolved, other that by deactivating the Advanced Custom Fields Multilingual plugin (on which I rely, so this solution is not acceptable for me).

Symptoms:

Questions:

June 19, 2024 at 4:23 pm #15757390

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

To be able to report the compatibility issues we need to replicate the issue on a clean installation.
I created a clean installation of WordPress, ACF, WPML, and all necessary WPML add-ons.
You can access the WordPress dashboard using the link below:

hidden link

Kindly follow the steps below:

- Add a few fields
- Use the Dynamic preview feature of the extended plugin.
- Replicate the problem
- Give us the steps to see the problem to be able to report

This will help us to report the probable issue to the compatibility team and solve the possible problem faster.

Thanks.

June 19, 2024 at 7:35 pm #15758360

daveR-5

Hi.

I've reproduced the problem in the sandbox. (note that i had to install ACF pro to use the flexible content field feature).

I have created a very simple preview file : /wp-content/themes/twentytwentyone/content_section.php (it just shows the content field text value with a border around it).

On the native language (fr) page, you can see a dynamic preview of the section : hidden link

On a translated version (en) of the same page, the dynamic preview is always empty : hidden link

Let me know if you have any questions.

June 22, 2024 at 11:15 am #15784633

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

Maybe it is a lack of knowledge about the extended plugin, but I do not see what you want to achieve and what the issue is. Please check the screenshots I attached showing the French and English versions. they are the same.

Maybe if you could use the loom.com website to create a video on what you want to achieve so I can understand the issue to report.

Thanks.

Screenshot 2024-06-22 at 15.14.57.png
Screenshot 2024-06-22 at 15.14.43.png
June 25, 2024 at 6:14 pm #15824186

daveR-5

Hi.
The issue is with the dynamic preview feature (which shows a preview of how the section would look like in the front-end).

You can click on the title of the section "Content section" to toggle between edit mode and preview mode.

In a page in the native language, the preview works fine (you should see a dashed green border around the content).
In the same page, in any other language, the preview is always empty.

See attached screenshots.

Let me know if you have any questions.

Edit-Page-“Test-page”-‹-Sandbox-—-WordPress (1).jpg
Edit-Page-“Test-page”-‹-Sandbox-—-WordPress.jpg
June 26, 2024 at 3:20 pm #15835420

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

I do not see what you gave in the screenshot on my browser. Maybe there is a browser issue? Can you test with another browser?

I created a video explaining this:

hidden link

Here is the link to the manual translation I mentioned int he video:

https://wpml.org/documentation/translating-your-contents/using-different-translation-editors-for-different-pages/

Thanks.

June 26, 2024 at 5:51 pm #15836464

daveR-5

Hi. Sorry, I guess I should have been more clear...

Here is a screenshot of specifically where to click to toggle the dynamic preview.

This is not a browser issue. It must certainly be a PHP issue.

Again, this is a problem directly related to the Advanced Custom Fields Multilingual plugin.
You can see this by deactivating this specific plugin (Advanced Custom Fields Multilingual) : it "fixes" the issue.
However, I need to use this plugin (for a lot of reasons), so this is not a workable solution.

Edit-Page-“Test-page”-‹-Sandbox-—-WordPress.jpg
June 30, 2024 at 12:41 pm #15862290

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

Thank you for the explanation. I reported this to the compatibility team.

I will get back to you as soon as I have news.

It will take time as our dev might need to contact the plugin developer.

Thanks.

July 6, 2024 at 1:40 pm #15903356

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

We have this issue while checking the preview option:

could you please add how to activate the dynamic preview feature? It worked initially but is gone now after changing some custom field translation settings. Could it be related? It doesn't work in the default language either.

Is there something that you could help us here when it comes to the preview feature that we might miss?

Thanks:

hidden link

July 8, 2024 at 1:55 pm #15913664

daveR-5

Hi. I changed back to field group settings so that the dynamic preview feature can work again.

Attached is a screenshot with the relevant field group settings highlighted.

Edit-Field-Group-“Page”-‹-Sandbox-—-WordPress.jpg
July 8, 2024 at 3:12 pm #15914272

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Thank you. Informed the compatibility team.

July 12, 2024 at 6:47 am #15940325

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

Unfortunately, the issue seems to be something that can not be handled only by us due to the nature of the files for the plugin in question.

We contacted the plugin developer nd we hope that we will get cooperation on their side.

This means the process might take longer as it depends on the responsiveness of the plugin developer.

Thanks.

July 15, 2024 at 1:30 pm #15954719

daveR-5

Thank you! Please keep me updated!

July 17, 2024 at 2:28 pm #15966773

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Sure thing. Thanks.

July 20, 2024 at 3:28 pm #15981668

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

I have an answer from the compatibility team:

Please add the code below to the functions.php file of your theme:

function wpml_translate_acf_post_id_compsupp_7448($preload, $post_id) {
    // If the post ID is already set by previous filters, return it
    if ($preload !== null) {
        return $preload;
    }

    // Check if WPML is active and the post ID is set
    if ( function_exists('wpml_object_id') && $post_id ) {
        // Get the post type for the given post ID
        $post_type = get_post_type($post_id);

        // If a post type is found, apply the WPML filter to get the translated ID
        if ( $post_type ) {
            return apply_filters('wpml_object_id', $post_id, $post_type, true);
        }
    }

    // Return the original post ID if no translation is needed or possible
    return $post_id;
}
add_filter('acf/pre_load_post_id', 'wpml_translate_acf_post_id_compsupp_7448', 10, 2);

A robust solution needs development work both from the plugin developer and our side which will take time and we are in contact with the developers of the plugin.

The workaround mentioned above is not a bulletproof one and might have side effects, but for now it is a solution.

Please get back to us with the result.

Thanks.

The topic ‘[Closed] ACF Extended Dynamic Preview not working on WPML non-primary language with the Advanced Custom Field…’ is closed to new replies.