Resolved by author
Reported for: WPML Multilingual CMS 4.5.14
Resolved in: Astra 3.9.4
Overview of the issue
Astra theme allows you to enable Custom Layouts from its options page. However, with the with its latest 3.9.3 release, any script added in the header or footer does not get loaded when using that feature.
Workaround
There are two workarounds you can try. Before proceeding with either, be sure to make a full backup.
Workaround 1
- Open /wp-content/plugins/astra-addon/classes/modules/target-rule/class-astra-target-rules-fields.php. file
- Look for line 1306.
- Replace:
if ( class_exists( 'SitePress' ) ) { global $sitepress; $check_wpml = true; $current_language = $sitepress->get_current_language(); $wpml_translate_query = "INNER JOIN {$wpdb->prefix}icl_translations as icl ON pm.post_id = icl.element_id"; $wpml_translate_query_condition = "AND icl.language_code = '{$current_language}'"; }
With:
if ( class_exists( 'SitePress' ) ) { global $sitepress; $cpt_translation_mode = apply_filters( 'wpml_sub_setting', false, 'custom_posts_sync_option', 'astra-advanced-hook' ); if ( $cpt_translation_mode != false ) { $check_wpml = true; $current_language = $sitepress->get_current_language(); $wpml_translate_query = "INNER JOIN {$wpdb->prefix}icl_translations as icl ON pm.post_id = icl.element_id"; $wpml_translate_query_condition = "AND icl.language_code = '{$current_language}'"; } }
Workaround 2
- Go to WPML → Settings → Post Type Translation.
- Switch the astra-advanced-hook post type to Translatable – use translation if available or fallback to default languageand Save.
- Switch back to Not Translatable and Save.
Thank you for posting this, maybe you should post the easy method at the bottom of the page first? That worked for me.
Please contact Astra to try to make WPML and Astra more compatible. This is the second time in a month the website has broken due to Astra-WPML compatibility, and it’s costing the client money running Google Ads.
Hello Craig,
We totally understand your concern. We are already in contact with the author and working together to solve this issue.
Thank you for your understanding.
Still not fixed by Astra…
Hello! Yes, we are still waiting for the author to incorporate the fixes and test further.
Hi There,
I have also this same issue but it’s fixed now. the same workaround is mention in the Astra addon’s latest update
https://wpastra.com/changelog/astra-pro-addon/
Thanks, WPML & Astra guys.
Hey Ganesh,
Thank you for your report.
Have a great day!
Hey everyone,
This issue was solved by the author with Astra +3.9.4 release.