@@ -81,15 +81,17 @@ public function get_default_value( $value, $post_id, $field ) {
81
81
return $ value ;
82
82
}
83
83
84
+ $ original_post_id = Helpers::original_option_id ( $ post_id );
85
+
84
86
/**
85
87
* Activate or deactivate the default value (all languages) for the given post id
86
88
*
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
89
91
*
90
92
* @since 1.0.4
91
93
*/
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 ) ) {
93
95
return $ value ;
94
96
}
95
97
@@ -127,10 +129,8 @@ public function get_default_value( $value, $post_id, $field ) {
127
129
remove_filter ( 'acf/settings/current_language ' , [ $ this , 'set_current_site_lang ' ] );
128
130
remove_filter ( 'acf/load_value ' , [ $ this , 'get_default_value ' ] );
129
131
130
- $ all_language_post_id = Helpers::original_option_id ( $ post_id );
131
-
132
132
// 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 ' ] );
134
134
135
135
/**
136
136
* Re-add deleted filters
@@ -158,10 +158,13 @@ function set_options_id_lang( $future_post_id, $original_post_id ) {
158
158
return $ future_post_id ;
159
159
}
160
160
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
+ }
165
168
}
166
169
167
170
return $ future_post_id ;
0 commit comments