ACF_WPML_Compatibility::icl_make_duplicate
icl_make_duplicate
description
Method of the class: ACF_WPML_Compatibility{}
No Hooks.
Returns
null. Nothing (null).
Usage
$ACF_WPML_Compatibility = new ACF_WPML_Compatibility(); $ACF_WPML_Compatibility->icl_make_duplicate( $master_post_id, $lang, $postarr, $id );
- $master_post_id(required)
- .
- $lang(required)
- .
- $postarr(required)
- .
- $id(required)
- .
Changelog
| Since 5.0.0 | Introduced. |
ACF_WPML_Compatibility::icl_make_duplicate() ACF WPML Compatibility::icl make duplicate code ACF 6.0.4
function icl_make_duplicate( $master_post_id, $lang, $postarr, $id ) {
// bail early if not acf-field-group
if ( $postarr['post_type'] != 'acf-field-group' ) {
return;
}
// update the lang
acf_update_setting( 'current_language', $lang );
// duplicate field group specifying the $post_id
acf_duplicate_field_group( $master_post_id, $id );
// always translate independately to avoid many many bugs!
// - translation post gets a new key (post_name) when origional post is saved
// - local json creates new files due to changed key
global $iclTranslationManagement;
$iclTranslationManagement->reset_duplicate_flag( $id );
}