This thread is resolved. Here is a description of the problem and solution.
Problem:
If you're experiencing issues with forms built in Elementor on a multilingual website not submitting unless logged in as an admin, this might be due to a compatibility issue between WPML and Elementor.
Solution:
We recommend the following steps to diagnose and potentially resolve the issue:
1. Ensure you have a backup of your site.
2. Disable all plugins except for WPML and Elementor.
3. Switch to a WordPress default theme.
4. Test if the issue still occurs, particularly on translated pages.
If the problem persists, it could be related to how WPML handles AJAX requests on translated forms. We found that adding the following code to your theme's
functions.php
file can resolve the issue:
add_action( 'wp_ajax_elementor_pro_forms_send_form', 'wssupp_set_language_ajax_form', 9 );<br />add_action( 'wp_ajax_nopriv_elementor_pro_forms_send_form', 'wssupp_set_language_ajax_form', 9 );<br />function wssupp_set_language_ajax_form(){<br /> $id = $_POST['post_id'];<br /> $post = get_post($id);<br /> $lang = apply_filters( 'wpml_element_language_code', NULL, ['element_id' => $id, 'element_type' => $post->post_type] );<br /> $current_language = apply_filters('wpml_current_language', NULL );<br /> if ( $lang != $current_language ) {<br /> do_action( 'wpml_switch_language', $lang );<br /> }<br />}
Please check if this resolves the issue. If you update your theme, you may need to re-add this code unless it's included in a future WPML release. Using a child theme can prevent the loss of custom code on theme updates.
If this solution does not apply to your case, or if it becomes outdated, we highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If issues persist, please open a new support ticket.
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 topic contains 6 replies, has 0 voices.
Last updated by 2 weeks, 5 days ago.
Assisted by: Dražen.