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
This issue is fixed in Astra 3.9.4. Updating solves it on your site, so you only need this workaround if you can’t update yet.
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:
With:PHP
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}'"; }
PHPif ( 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 WPMLSettingsPost 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.