ACF_WPML_Compatibility::icl_make_duplicate()publicACF 5.0.0

icl_make_duplicate

description

Метод класса: ACF_WPML_Compatibility{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$ACF_WPML_Compatibility = new ACF_WPML_Compatibility();
$ACF_WPML_Compatibility->icl_make_duplicate( $master_post_id, $lang, $postarr, $id );
$master_post_id (обязательный)
-
$lang (обязательный)
-
$postarr (обязательный)
-
$id (обязательный)
-

Список изменений

С версии 5.0.0 Введена.

Код ACF_WPML_Compatibility::icl_make_duplicate() 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 );
}