@@ -81,15 +81,17 @@ public function get_default_value( $value, $post_id, $field ) {
8181 return $ value ;
8282 }
8383
84+ $ original_post_id = Helpers::original_option_id ( $ post_id );
85+
8486 /**
8587 * Activate or deactivate the default value (all languages) for the given post id
8688 *
87- * @param bool $show_default : whatever to show default for the given post id
88- * @param string $post_id : the original post id without lang attributes
89+ * @param bool $show_default : whatever to show default for the given post id
90+ * @param string $original_post_id : the original post id without lang attributes
8991 *
9092 * @since 1.0.4
9193 */
92- if ( ! apply_filters ( 'bea.aofp.get_default ' , true , Helpers:: original_option_id ( $ post_id ) ) ) {
94+ if ( ! apply_filters ( 'bea.aofp.get_default ' , true , $ original_post_id ) ) {
9395 return $ value ;
9496 }
9597
@@ -127,10 +129,8 @@ public function get_default_value( $value, $post_id, $field ) {
127129 remove_filter ( 'acf/settings/current_language ' , [ $ this , 'set_current_site_lang ' ] );
128130 remove_filter ( 'acf/load_value ' , [ $ this , 'get_default_value ' ] );
129131
130- $ all_language_post_id = Helpers::original_option_id ( $ post_id );
131-
132132 // Get the "All language" value
133- $ value = acf_get_metadata ( $ all_language_post_id , $ field ['name ' ] );
133+ $ value = acf_get_metadata ( $ original_post_id , $ field ['name ' ] );
134134
135135 /**
136136 * Re-add deleted filters
@@ -158,10 +158,13 @@ function set_options_id_lang( $future_post_id, $original_post_id ) {
158158 return $ future_post_id ;
159159 }
160160
161- $ dl = acf_get_setting ( 'default_language ' );
162- $ cl = acf_get_setting ( 'current_language ' );
163- if ( $ cl && $ cl !== $ dl ) {
164- $ future_post_id .= '_ ' . $ cl ;
161+ // If no custom acf key, no need while already impacted by Polylang locale
162+ if ( 'options ' !== Helpers::original_option_id ( $ future_post_id ) ) {
163+ $ dl = acf_get_setting ( 'default_language ' );
164+ $ cl = acf_get_setting ( 'current_language ' );
165+ if ( $ cl && $ cl !== $ dl ) {
166+ $ future_post_id .= '_ ' . $ cl ;
167+ }
165168 }
166169
167170 return $ future_post_id ;
0 commit comments