Function Reference: geodir_icl_make_duplicate
Summary
Duplicate post details for WPML translation post.
Parameters
- $master_post_id
- (int) (required) Original Post ID.
- Default: None
- $lang
- (string) (required) Language code for translating post.
- Default: None
- $postarr
- (array) (required) Array of post data.
- Default: None
- $tr_post_id
- (int) (required) Translation Post ID.
- Default: None
- $after_save
- (bool) (required) If true it will force duplicate. Added to fix duplicate translation for front end.
- Default: None
Change Log
Since: 1.5.0
1.6.16 Sync reviews if sync comments allowed.
Source File
geodir_icl_make_duplicate() is located in geodirectory-functions/custom_functions.php [Line: 2559]
Source Code
function geodir_icl_make_duplicate($master_post_id, $lang, $postarr, $tr_post_id, $after_save = false) { global $sitepress; $post_type = get_post_type($master_post_id); $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 (in_array($post_type, geodir_get_posttypes())) { if ($icl_ajx_action || $after_save) { // Duplicate post details geodir_icl_duplicate_post_details($master_post_id, $tr_post_id, $lang); // Duplicate taxonomies geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang); // Duplicate post images geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang); } // Sync post reviews if ($sitepress->get_setting('sync_comments_on_duplicates')) { geodir_wpml_duplicate_post_reviews($master_post_id, $tr_post_id, $lang); } } }