Skip to content Skip to sidebar

This thread is resolved. Here is a description of the problem and solution.

Problem:
If you're experiencing a JavaScript error in the WordPress admin related to the ACFML (Advanced Custom Fields Multilingual) plugin, where the browser console shows a 'ReferenceError: Can't find variable: wp', this is due to ACFML attempting to call wp.data.dispatch() before the wp object is defined.
Solution:
As a temporary workaround, you can implement a polyfill in your theme's functions.php file. Here's how:

add_action( 'wp_loaded', 'your_custom_fix_acfml_notice', 100 );<br />function your_custom_fix_acfml_notice() {<br />    if ( ! class_exists( '\ACFML\Post\MixedFieldGroupModesHooks' ) ) {<br />        return;<br />    }<br />    add_action( 'wp_print_scripts', 'your_acfml_polyfill', 1 );<br />}<br />function your_acfml_polyfill() {<br />    ?><br />    if ( typeof wp === 'undefined' ) {<br />        window.wp = {};<br />    }<br />    if ( typeof wp.data === 'undefined' ) {<br />        window.wp.data = {<br />            dispatch: function(store) {<br />                return {<br />                    createNotice: function(type, message, options) {<br />                        document.addEventListener('DOMContentLoaded', function() {<br />                            if (window.wp && window.wp.data && window.wp.data.dispatch) {<br />                                window.wp.data.dispatch(store).createNotice(type, message, options);<br />                            }<br />                        });<br />                    }<br />                };<br />            }<br />        };<br />    }<br />    <?php<br />}<br />

This workaround prevents the error until the real wp.data becomes available. However, this is only a temporary solution. We have escalated this issue to our development team, and it should be addressed in the upcoming ACFML release 3.0.0.

Please note that this solution might be irrelevant if it's outdated or not applicable to your case. We highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the problem persists, please open a new support ticket at WPML support forum.

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.

Tagged: 

This topic contains 25 replies, has 0 voices.

Last updated by Dražen 2 weeks, 4 days ago.

Assisted by: Dražen.

Author Posts
July 1, 2026 at 12:48 pm #18135741

Philip

Hi Drazen,

Sorry to bother you.

Is there a plan to release a new version of ACFM soon? We're eagerly waiting for the fix.

Thank you!

July 1, 2026 at 1:17 pm #18135778

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

No problem at all.

The fix is already included in the upcoming version. The beta is expected to be released within the next 1–2 days, so you'll be able to install it and verify that the issue is resolved on your site.

Unfortunately, the final ACFML release is tied to the next major WPML release, so it has been waiting for that release cycle. The good news is that the beta should be available very soon, and if everything goes well during testing, the final stable version should follow a few weeks later.

Please give the beta a try once it's available, and let me know if you encounter any issues ( WPML 5.0 Beta and ACFML 3.3.0. Beta).

Sorry for delays.

Regards,
Drazen

July 9, 2026 at 10:42 am #18149104

Philip

Hi Drazen,

Thank you for the update.

Could you please let me know how I can switch to the Beta channel?

I'm not sure where to enable Beta versions, and I couldn't find this option in my WPML account or in the plugin installer.

Thanks!

July 9, 2026 at 12:04 pm #18149253

Dražen
Supporter

Hi,

Sure! You can switch to the Beta channel directly from your WordPress admin:

- Go to Plugins → Add New Plugin → Commercial.
- At the top of the page, change the Release Channel from Production to Beta.
- Click Check for updates.
- The latest beta versions of the WPML plugins will become available for installation/update.

You can also follow our guide here, which includes screenshots:
- https://wpml.org/faq/how-to-install-beta-and-development-versions-of-wpml/

Regards,
Drazen

July 10, 2026 at 2:56 pm #18151829

Philip

Hi Drazen,

Thank you for explaining this.

I have registered the DEV site successfully, but I still don't see the Release Channel selector on the Commercial page. I only see the Check for updates button which I clicked but no luck.

Screenshot: hidden link

Could you please check if the beta is already available for my account, or let me know if there is anything else I need to do?

Thank you.

July 13, 2026 at 7:27 am #18154220

Dražen
Supporter

Hi,

Thank you for checking.

The beta version is not publicly available yet, which is why you don't see the Release Channel selector. Once it is released, you'll also be able to download it directly from the Downloads page also:

- https://wpml.org/download/acfml/?section=changelog

In the meantime, I've asked our developers whether it's okay for me to share the beta version with you before the official release. As soon as I receive their confirmation, I'll update you here.

Thank you for your patience!

Regards,
Drazen

July 13, 2026 at 7:54 am #18154264

Dražen
Supporter

Hi,

Please find the beta version on the following link:

hidden link

Please install it only on your staging or development website and do not use it on a production site, as this is a pre-release version intended for testing.

This beta is designed to work together with the upcoming WPML release, so for the most accurate results it should be tested alongside the latest beta versions of the WPML plugins when they are out.

Please let us know how it goes.

Regards,
Drazen

July 27, 2026 at 12:46 pm #18179349

Philip

Hi Dražen,

Sorry for the delay, and thank you again for providing the beta version.

Unfortunately, it looks like the WeTransfer link has expired, so we can no longer download the package.

Would it be possible for you to upload it again and send us a new download link?

Thank you in advance! We really appreciate your help.

Best regards

July 27, 2026 at 1:19 pm #18179405

Dražen
Supporter

Hi,

No worries, and thank you for letting us know.

The beta version has now been officially released, so you can simply download the latest version from your WPML.org account under the Downloads section.

Please let us know if you run into any issues after updating.

- https://wpml.org/download/wpml-multilingual-cms/?section=changelog
- https://wpml.org/download/wpml-string-translation/?section=changelog
- https://wpml.org/download/acfml/?section=changelog

Best regards,
Dražen

July 27, 2026 at 1:59 pm #18179482

Philip

Hi Dražen,

Thank you for the update.

I can confirm that after updating all three plugins to the latest versions, the issue no longer occurs in our local environment. It looks like the problem has been resolved.

Thank you very much for your help and for fixing this! We really appreciate it.

Best regards

July 27, 2026 at 2:27 pm #18179591

Dražen
Supporter

Hi,

That's great to hear!

I'll go ahead and close this ticket now. If you run into any other issues or have any questions in the future, please don't hesitate to open a new ticket.

Regards,
Dražen