Function Reference: geodir_wpml_duplicate_listing

Summary

Duplicate post listing manually after listing saved.

Parameters

$post_id
(int) (required) The Post ID.

Default: None
$lang
(string) (required) Language code for translating post.

Default: None
$request_info
(array) (required) The post details in an array.

Default: None

Change Log

Since: 1.6.16 Sync reviews if sync comments allowed.

1.6.25 “geodir_wpml_listing_duplicated” action added.

Actions

‘geodir_wpml_listing_duplicated’ [Line: 2610]

Source File

geodir_wpml_duplicate_listing() is located in geodirectory-functions/custom_functions.php [Line: 2598]

Source Code

function geodir_wpml_duplicate_listing($post_id, $request_info) {
	global $sitepress;

	$icl_ajx_action = !empty($_REQUEST['icl_ajx_action']) && $_REQUEST['icl_ajx_action'] == 'make_duplicates' ? true : false;
	if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'wpml_duplicate_dashboard' && !empty($_REQUEST['duplicate_post_ids'])) {
		$icl_ajx_action = true;
	}

	if (!$icl_ajx_action && in_array(get_post_type($post_id), geodir_get_posttypes()) && $post_duplicates = $sitepress->get_duplicates($post_id)) {
		foreach ($post_duplicates as $lang => $dup_post_id) {
			geodir_icl_make_duplicate($post_id, $lang, $request_info, $dup_post_id, true);
		}
		do_action( 'geodir_wpml_listing_duplicated', $post_id, $request_info );
	}
}