Home › Forums › ACF PRO › Can you force a source language in a front-end form ? › Reply To: Can you force a source language in a front-end form ?
Not needed anymore, fixed with a WPML filter.
function sd_change_language( $post_id ) {
if ( 'post_type' == get_post_type( $post_id ) ) {
$wpml_element_type = apply_filters( 'wpml_element_type', 'post_type' );
$get_language_args = array( 'element_id' => $post_id, 'element_type' => 'post_type' );
$original_post_language_info = apply_filters( 'wpml_element_language_details', null, $get_language_args );
$set_language_args = array(
'element_id' => $post_id,
'element_type' => $wpml_element_type,
'trid' => $original_post_language_info->trid,
'language_code' => 'en', // language code to change it to
'source_language_code' => null
);
do_action( 'wpml_set_element_language_details', $set_language_args );
}
}
add_action( 'acf/save_post', 'sd_change_language', 1, 1 );
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.