WooCommerce Multilingual – run WooCommerce with WPML - Version 1.2

Version Description

  • Added helpful documentation buttons
  • Added makes new attributes translatable automatically
  • Added payment gateways translations
  • Fixed order statuses disappeared in the orders page
  • Fixed attributes translations in duplicated variations
  • Fixed PHP warning when adding variations is in question
Download this release

Release Info

Developer AmirHelzer
Plugin Icon 128x128 WooCommerce Multilingual – run WooCommerce with WPML
Version 1.2
Comparing to
See all releases

Code changes from version 1.1 to 1.2

Files changed (4) hide show
  1. readme.txt +15 -3
  2. screenshot-3.png +0 -0
  3. wpml-config.xml +2 -1
  4. wpml-woocommerce.php +170 -34
readme.txt CHANGED
@@ -4,8 +4,8 @@ Donate link: http://wp-types.com
4
  Tags: CMS, woocommerce, commerce, ecommerce, e-commerce, products, WPML, multilingual, e-shop, shop
5
  Requires at least: 3.0
6
  Tested up to: 3.3.2
7
- Stable tag: 1.1
8
- Version: 1.1
9
 
10
  Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
11
 
@@ -15,7 +15,7 @@ This 'glue' plugin makes it possible to run fully multilingual e-commerce sites
15
 
16
  = Features =
17
 
18
- * Lets you translate products, variations and categories
19
  * Keeps the same language through the checkout process
20
  * Sends emails to clients and admins in their selected language
21
  * Allows inventory tracking without breaking products into languages
@@ -56,9 +56,18 @@ In order for the checkout and store pages to appear translated, you need to crea
56
 
57
  1. Translation controls for products
58
  2. Enabling multi-currency
 
59
 
60
  == Changelog ==
61
 
 
 
 
 
 
 
 
 
62
  = 1.1 =
63
  * Added multi-currency feature
64
  * Fixed synchronization of attributes and variations
@@ -80,6 +89,9 @@ In order for the checkout and store pages to appear translated, you need to crea
80
 
81
  == Upgrade Notice ==
82
 
 
 
 
83
  = 1.1 =
84
  Fixed a few bugs. Added multi-currency mode.
85
 
4
  Tags: CMS, woocommerce, commerce, ecommerce, e-commerce, products, WPML, multilingual, e-shop, shop
5
  Requires at least: 3.0
6
  Tested up to: 3.3.2
7
+ Stable tag: 1.2
8
+ Version: 1.2
9
 
10
  Allows running fully multilingual e-commerce sites using WooCommerce and WPML.
11
 
15
 
16
  = Features =
17
 
18
+ * Lets you translate products, attributes and categories
19
  * Keeps the same language through the checkout process
20
  * Sends emails to clients and admins in their selected language
21
  * Allows inventory tracking without breaking products into languages
56
 
57
  1. Translation controls for products
58
  2. Enabling multi-currency
59
+ 3. Product categories translations
60
 
61
  == Changelog ==
62
 
63
+ = 1.2 =
64
+ * Added helpful documentation buttons
65
+ * Added makes new attributes translatable automatically
66
+ * Added payment gateways translations
67
+ * Fixed order statuses disappeared in the orders page
68
+ * Fixed attributes translations in duplicated variations
69
+ * Fixed PHP warning when adding variations is in question
70
+
71
  = 1.1 =
72
  * Added multi-currency feature
73
  * Fixed synchronization of attributes and variations
89
 
90
  == Upgrade Notice ==
91
 
92
+ = 1.2 =
93
+ Added a few improvements and fixed bugs.
94
+
95
  = 1.1 =
96
  Fixed a few bugs. Added multi-currency mode.
97
 
screenshot-3.png ADDED
Binary file
wpml-config.xml CHANGED
@@ -66,7 +66,8 @@
66
  <taxonomies>
67
  <taxonomy translate="1">product_cat</taxonomy>
68
  <taxonomy translate="1">product_type</taxonomy>
69
- <taxonomy translate="1">shop_order_status</taxonomy>
70
  <taxonomy translate="1">link_category</taxonomy>
 
71
  </taxonomies>
72
  </wpml-config>
66
  <taxonomies>
67
  <taxonomy translate="1">product_cat</taxonomy>
68
  <taxonomy translate="1">product_type</taxonomy>
69
+ <taxonomy translate="0">shop_order_status</taxonomy>
70
  <taxonomy translate="1">link_category</taxonomy>
71
+ <taxonomy translate="1">product_tag</taxonomy>
72
  </taxonomies>
73
  </wpml-config>
wpml-woocommerce.php CHANGED
@@ -5,10 +5,10 @@
5
  Description: Allows running fully multilingual e-Commerce sites with WooCommerce and WPML. <a href="http://wpml.org/documentation/related-projects/woocommerce-multilingual/">Documentation</a>.
6
  Author: ICanLocalize
7
  Author URI: http://wpml.org/
8
- Version: 1.1
9
  */
10
 
11
- define('WCML_VERSION', '1.1');
12
  define('WCML_PLUGIN_PATH', dirname(__FILE__));
13
  define('WCML_PLUGIN_FOLDER', basename(WCML_PLUGIN_PATH));
14
  define('WCML_PLUGIN_URL', plugins_url() . '/' . WCML_PLUGIN_FOLDER);
@@ -72,12 +72,15 @@ function wpml_woocommerce_multilingual_init(){
72
  add_action('updated_post_meta', 'wpml_updated_post_meta_hook', 10, 4);
73
 
74
  add_action('admin_head', 'wpml_synchronizate_variations', 15);
75
- //add_action('save_post', 'wpml_synchronization_of_variations', 16);
76
 
77
  add_action('admin_menu', 'wpml_menu');
78
- add_action('init', 'wpml_change_permalinks');
79
  add_action('init', 'wpml_load_css_and_js');
80
 
 
 
 
 
81
  if(isset($_POST['general_options']) && check_admin_referer('general_options', 'general_options_nonce')){
82
  $enable_multi_currency = (isset($_POST['multi_currency'])) ? trim($_POST['multi_currency']) : null;
83
 
@@ -140,7 +143,7 @@ function wpml_woocommerce_multilingual_init(){
140
  }
141
  }
142
 
143
- if($_GET['page'] == 'wpml-wcml' && isset($_GET['delete']) && $_GET['delete'] == $_GET['delete']){
144
  global $wpdb;
145
 
146
  $remove_id = $_GET['delete'];
@@ -153,6 +156,120 @@ function wpml_woocommerce_multilingual_init(){
153
 
154
  wp_safe_redirect(admin_url('admin.php?page=wpml-wcml'));
155
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  }
157
 
158
  /**
@@ -508,20 +625,8 @@ function wpml_ajax_params($value){
508
  } else if($translated_checkout_page_id == $post->ID || $checkout_page_id == $post->ID){
509
  $value['is_checkout'] = 1;
510
 
511
- // Recreates woocommerce.params.locale
512
- $value['locale'] = '{"AT":{"postcode_before_city":true,"state":{"required":false}},"BE":{"postcode_before_city":true,"state":{"required":false}},
513
- "CA":{"state":{"label":"Province"}},"CL":{"city":{"required":false},"state":{"label":"Municipalit\u00e9"}},"CN":{"state":{"label":"Province"}},
514
- "CZ":{"state":{"required":false}},"DE":{"postcode_before_city":true,"state":{"required":false}},
515
- "DK":{"postcode_before_city":true,"state":{"required":false}},"FI":{"postcode_before_city":true,"state":{"required":false}},
516
- "FR":{"postcode_before_city":true,"state":{"required":false}},"HK":{"postcode":{"required":false},"city":{"label":"Ville \/ Quartier"},"state":{"label":"R\u00e9gion"}},
517
- "HU":{"state":{"required":false}},
518
- "IS":{"postcode_before_city":true,"state":{"required":false}},"IL":{"postcode_before_city":true,"state":{"required":false}},
519
- "NL":{"postcode_before_city":true,"state":{"required":false}},"NZ":{"state":{"required":false}},"NO":{"postcode_before_city":true,"state":{"required":false}},
520
- "PL":{"postcode_before_city":true,"state":{"required":false}},"RO":{"state":{"required":false}},"SG":{"state":{"required":false}},
521
- "SK":{"postcode_before_city":true,"state":{"required":false}},"SI":{"postcode_before_city":true,"state":{"required":false}},
522
- "ES":{"postcode_before_city":true,"state":{"label":"Province"}},"LK":{"state":{"required":false}},"SE":{"postcode_before_city":true,"state":{"required":false}},
523
- "TR":{"postcode_before_city":true,"state":{"label":"Province"}},"US":{"postcode":{"label":"Code postal"},"state":{"label":"State"}},
524
- "GB":{"postcode":{"label":"Code Postal"},"state":{"label":"Comt\u00e9"}},"default":{"postcode":{"label":"Code Postal \/ Zip"},"city":{"label":"Ville"},"state":{"label":"Etat\/Pays"}}}';
525
  $_SESSION['wpml_globalcart_language'] = $sitepress->get_current_language();
526
 
527
  } else if($translated_pay_page_id == $post->ID){
@@ -609,9 +714,6 @@ function wpml_in_cart_product_title($title, $_product){
609
  function wpml_ls_filter($languages) {
610
  global $post, $sitepress;
611
 
612
- $translated_checkout_page_id = icl_object_id(get_option('woocommerce_checkout_page_id'), 'page', false);
613
- $shop_page_id = get_option('woocommerce_shop_page_id');
614
-
615
  if(strpos(basename($_SERVER['REQUEST_URI']), 'post_type') !== false ||
616
  strpos(basename($_SERVER['REQUEST_URI']), 'shop') !== false){
617
 
@@ -621,6 +723,7 @@ function wpml_ls_filter($languages) {
621
  }
622
  }
623
 
 
624
  return $languages;
625
  }
626
 
@@ -631,6 +734,7 @@ function wpml_ls_filter($languages) {
631
  * @global type $wpdb
632
  * @return type
633
  */
 
634
  function wpml_change_permalinks(){
635
  global $wpdb;
636
 
@@ -640,7 +744,7 @@ function wpml_change_permalinks(){
640
  if($posts_query['post_name'] !== 'shop'){
641
  $wpdb->update($wpdb->posts, array('post_name' => 'shop'), array('post_name' => $posts_query['post_name']));
642
  }
643
- }
644
 
645
  /**
646
  * Creates WCML page.
@@ -700,9 +804,13 @@ function wpml_post_alternative_languages($output){
700
  * @return type
701
  */
702
  function wpml_translate_attributes($name){
703
- icl_register_string('woocommerce', $name .'_attribute', $name);
 
704
 
705
- return icl_t('woocommerce', $name .'_attribute', $name);
 
 
 
706
  }
707
 
708
  /**
@@ -737,10 +845,10 @@ function wpml_woocommerce_upsell_crosssell_search_posts($posts){
737
  * @return type
738
  */
739
  function wpml_synchronizate_variations() {
740
- global $wpdb, $pagenow, $post;
741
 
742
- $post_id = $post->ID;
743
- $post_type = get_post_type($post->ID);
744
 
745
  if($pagenow == 'post.php' || $pagenow == 'post-new.php' && $post_type == 'product'){
746
  $duplicated_post_id = get_post_meta($post_id, '_icl_lang_duplicate_of', TRUE);
@@ -758,16 +866,44 @@ function wpml_synchronizate_variations() {
758
  // synchronize term data, postmeta and post variations
759
  if($is_post_has_variations){
760
  $get_all_term_data = $wpdb->get_results("SELECT * FROM $wpdb->term_relationships WHERE object_id = '$duplicated_post_id'");
 
 
 
 
 
 
761
 
762
- // synchronize term data
763
- foreach($get_all_term_data as $k => $term_relationship){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
764
 
765
  $wpdb->insert(
766
  $wpdb->term_relationships,
767
  array(
768
  'object_id' => $post_id,
769
- 'term_taxonomy_id' => $term_relationship->term_taxonomy_id,
770
- 'term_order' => $term_relationship->term_order
771
  ));
772
 
773
  }
@@ -808,7 +944,7 @@ function wpml_synchronizate_variations() {
808
  'post_modified' => $post_data->post_modified,
809
  'post_modified_gmt' => $post_data->post_modified_gmt,
810
  'post_content_filtered' => $post_data->post_content_filtered,
811
- 'post_parent' => $post_id, // current post id
812
  'guid' => $replaced_guid,
813
  'menu_order' => $post_data->menu_order,
814
  'post_type' => $post_data->post_type,
@@ -849,4 +985,4 @@ function wpml_synchronizate_variations() {
849
  }
850
  }
851
 
852
- ?>
5
  Description: Allows running fully multilingual e-Commerce sites with WooCommerce and WPML. <a href="http://wpml.org/documentation/related-projects/woocommerce-multilingual/">Documentation</a>.
6
  Author: ICanLocalize
7
  Author URI: http://wpml.org/
8
+ Version: 1.2
9
  */
10
 
11
+ define('WCML_VERSION', '1.2');
12
  define('WCML_PLUGIN_PATH', dirname(__FILE__));
13
  define('WCML_PLUGIN_FOLDER', basename(WCML_PLUGIN_PATH));
14
  define('WCML_PLUGIN_URL', plugins_url() . '/' . WCML_PLUGIN_FOLDER);
72
  add_action('updated_post_meta', 'wpml_updated_post_meta_hook', 10, 4);
73
 
74
  add_action('admin_head', 'wpml_synchronizate_variations', 15);
 
75
 
76
  add_action('admin_menu', 'wpml_menu');
77
+ //add_action('init', 'wpml_change_permalinks');
78
  add_action('init', 'wpml_load_css_and_js');
79
 
80
+ if(is_admin()){
81
+ add_action('admin_init', 'wpml_make_new_attributes_translatable');
82
+ }
83
+
84
  if(isset($_POST['general_options']) && check_admin_referer('general_options', 'general_options_nonce')){
85
  $enable_multi_currency = (isset($_POST['multi_currency'])) ? trim($_POST['multi_currency']) : null;
86
 
143
  }
144
  }
145
 
146
+ if(isset($_GET['page']) && $_GET['page'] == 'wpml-wcml' && isset($_GET['delete']) && $_GET['delete'] == $_GET['delete']){
147
  global $wpdb;
148
 
149
  $remove_id = $_GET['delete'];
156
 
157
  wp_safe_redirect(admin_url('admin.php?page=wpml-wcml'));
158
  }
159
+
160
+ add_action('admin_footer', 'documentation_links');
161
+ add_action('admin_notices', 'admin_notice_after_install');
162
+
163
+ if(isset($_GET['wcml_action']) && $_GET['wcml_action'] = 'dismiss'){
164
+ update_option('wpml_dismiss_doc_main', 'yes');
165
+ }
166
+
167
+ register_deactivation_hook(__FILE__, 'wpml_wcml_deactivate');
168
+ }
169
+
170
+ /**
171
+ * WooCommerce Multilingual deactivation hook.
172
+ */
173
+ function wpml_wcml_deactivate(){
174
+ delete_option('wpml_dismiss_doc_main');
175
+ }
176
+
177
+ /**
178
+ * Outputs documentation links.
179
+ */
180
+ function documentation_links(){
181
+ global $post, $pagenow;
182
+
183
+ $get_post_type = get_post_type(@$post->ID);
184
+
185
+ if($get_post_type == 'product' && $pagenow == 'edit.php'){
186
+ $prot_link = '<span class="button" style="padding:4px;margin-top:10px;"><img align="baseline" src="' . ICL_PLUGIN_URL .'/res/img/icon16.png" width="16" height="16" style="margin-bottom:-4px" /> <a href="http://wpml.org/documentation/related-projects/woocommerce-multilingual/#translating_products" target="_blank">' .
187
+ __('How to translate products', 'sitepress') . '<\/a>' . '<\/span>'
188
+ ?>
189
+ <script type="text/javascript">
190
+ jQuery(".subsubsub").append('<?php echo $prot_link ?>');
191
+ </script>
192
+ <?php
193
+ }
194
+
195
+ if(isset($_GET['taxonomy'])){
196
+ $pos = strpos($_GET['taxonomy'], 'pa_');
197
+
198
+ if($pos !== false && $pagenow == 'edit-tags.php'){
199
+ $prot_link = '<span class="button" style="padding:4px;margin-top:0px; float: left;"><img align="baseline" src="' . ICL_PLUGIN_URL .'/res/img/icon16.png" width="16" height="16" style="margin-bottom:-4px" /> <a href="http://wpml.org/documentation/related-projects/woocommerce-multilingual/#translating_attributes" target="_blank" style="text-decoration: none;">' .
200
+ __('How to translate attributes', 'sitepress') . '<\/a>' . '<\/span><br \/><br \/>'
201
+ ?>
202
+ <script type="text/javascript">
203
+ jQuery("table.widefat").before('<?php echo $prot_link ?>');
204
+ </script>
205
+ <?php
206
+ }
207
+ }
208
+
209
+ if(isset($_GET['taxonomy']) && $_GET['taxonomy'] == 'product_cat'){
210
+
211
+ $prot_link = '<span class="button" style="padding:4px;margin-top:0px; float: left;"><img align="baseline" src="' . ICL_PLUGIN_URL .'/res/img/icon16.png" width="16" height="16" style="margin-bottom:-4px" /> <a href="http://wpml.org/documentation/related-projects/woocommerce-multilingual/#translating_product_categories" target="_blank" style="text-decoration: none;">' .
212
+ __('How to translate product categories', 'sitepress') . '<\/a>' . '<\/span><br \/><br \/>'
213
+ ?>
214
+ <script type="text/javascript">
215
+ jQuery("table.widefat").before('<?php echo $prot_link ?>');
216
+ </script>
217
+ <?php
218
+ }
219
+ }
220
+
221
+ /**
222
+ * Admin notice after plugin install.
223
+ */
224
+ function admin_notice_after_install(){
225
+ if(get_option('wpml_dismiss_doc_main') != 'yes'){
226
+
227
+ $url = $_SERVER['REQUEST_URI'];
228
+ $pos = strpos($url, '?');
229
+
230
+ if($pos !== false){
231
+ $url .= '&wcml_action=dismiss';
232
+ } else {
233
+ $url .= '?wcml_action=dismiss';
234
+ }
235
+ ?>
236
+ <div id="message" class="updated message fade" style="clear:both;margin-top:5px;"><p>
237
+ <?php _e('Would you like to see a quick overview?', 'sitepress'); ?>
238
+ </p>
239
+ <p>
240
+ <a class="button-primary" href="http://wpml.org/documentation/related-projects/woocommerce-multilingual/" target="_blank">Learn how to turn your e-commerce site multilingual</a>
241
+ <a class="button-secondary" href="<?php echo $url; ?>">Dismiss</a>
242
+ </p>
243
+ </div>
244
+ <?php
245
+ }
246
+ }
247
+
248
+ /**
249
+ * Makes all new attributes as translatable.
250
+ */
251
+ function wpml_make_new_attributes_translatable(){
252
+ if(isset($_GET['page']) && $_GET['page'] == 'woocommerce_attributes'){
253
+
254
+ $wpml_settings = get_option('icl_sitepress_settings');
255
+
256
+ $get_all_taxonomies = get_taxonomies(@$args['name']);
257
+
258
+ foreach($get_all_taxonomies as $tax_key => $taxonomy){
259
+ $pos = strpos($taxonomy, 'pa_');
260
+
261
+ // get only product attribute taxonomy name
262
+ if($pos !== false){
263
+ foreach($wpml_settings['taxonomies_sync_option'] as $wpml_tax_key => $tax){
264
+ // set it as translatable
265
+ $wpml_settings['taxonomies_sync_option'][$taxonomy] = 1;
266
+ }
267
+ }
268
+ }
269
+
270
+ update_option('icl_sitepress_settings', $wpml_settings);
271
+
272
+ }
273
  }
274
 
275
  /**
625
  } else if($translated_checkout_page_id == $post->ID || $checkout_page_id == $post->ID){
626
  $value['is_checkout'] = 1;
627
 
628
+ $value['locale'] = '';
629
+
 
 
 
 
 
 
 
 
 
 
 
 
630
  $_SESSION['wpml_globalcart_language'] = $sitepress->get_current_language();
631
 
632
  } else if($translated_pay_page_id == $post->ID){
714
  function wpml_ls_filter($languages) {
715
  global $post, $sitepress;
716
 
 
 
 
717
  if(strpos(basename($_SERVER['REQUEST_URI']), 'post_type') !== false ||
718
  strpos(basename($_SERVER['REQUEST_URI']), 'shop') !== false){
719
 
723
  }
724
  }
725
 
726
+
727
  return $languages;
728
  }
729
 
734
  * @global type $wpdb
735
  * @return type
736
  */
737
+ /*
738
  function wpml_change_permalinks(){
739
  global $wpdb;
740
 
744
  if($posts_query['post_name'] !== 'shop'){
745
  $wpdb->update($wpdb->posts, array('post_name' => 'shop'), array('post_name' => $posts_query['post_name']));
746
  }
747
+ }*/
748
 
749
  /**
750
  * Creates WCML page.
804
  * @return type
805
  */
806
  function wpml_translate_attributes($name){
807
+ if(function_exists('icl_register_string')){
808
+ icl_register_string('woocommerce', $name .'_attribute', $name);
809
 
810
+ $name = icl_t('woocommerce', $name .'_attribute', $name);
811
+ }
812
+
813
+ return $name;
814
  }
815
 
816
  /**
845
  * @return type
846
  */
847
  function wpml_synchronizate_variations() {
848
+ global $wpdb, $pagenow, $post, $sitepress;
849
 
850
+ $post_id = @$post->ID;
851
+ $post_type = @get_post_type($post->ID);
852
 
853
  if($pagenow == 'post.php' || $pagenow == 'post-new.php' && $post_type == 'product'){
854
  $duplicated_post_id = get_post_meta($post_id, '_icl_lang_duplicate_of', TRUE);
866
  // synchronize term data, postmeta and post variations
867
  if($is_post_has_variations){
868
  $get_all_term_data = $wpdb->get_results("SELECT * FROM $wpdb->term_relationships WHERE object_id = '$duplicated_post_id'");
869
+
870
+ foreach($get_all_term_data as $k => $term_relationship){
871
+ $term_taxonomy_id = $term_relationship->term_taxonomy_id;
872
+ $term_taxonomy_id_data = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = '$term_taxonomy_id'");
873
+
874
+ $all_data = $wpdb->get_results("SELECT * FROM ". $wpdb->prefix ."icl_translations WHERE element_id = '$term_taxonomy_id'");
875
 
876
+ $terms_translations[$k]['object_id'] = $term_relationship->object_id;
877
+ $terms_translations[$k]['term_taxonomy_id'] = $term_relationship->term_taxonomy_id;
878
+ $terms_translations[$k]['term_order'] = $term_relationship->term_order;
879
+ $terms_translations[$k]['element_type'] = $all_data[0]->element_type;
880
+ $terms_translations[$k]['trid'] = $all_data[0]->trid;
881
+ $terms_translations[$k]['source_lang'] = $all_data[0]->source_language_code;
882
+ }
883
+
884
+ foreach($terms_translations as $key => $term){
885
+ $trid = $term['trid'];
886
+
887
+ $all_data_db = $wpdb->get_results("SELECT * FROM ". $wpdb->prefix ."icl_translations WHERE trid = '$trid'");
888
+
889
+ foreach($all_data_db as $k => $value){
890
+ if($value->source_language_code){
891
+ $found_element_id = $value->element_id;
892
+
893
+ $terms_translations[$key]['term_taxonomy_id'] = $found_element_id;
894
+ }
895
+ }
896
+ }
897
+
898
+ // synchronize term data
899
+ foreach($terms_translations as $k => $term_relationship){
900
 
901
  $wpdb->insert(
902
  $wpdb->term_relationships,
903
  array(
904
  'object_id' => $post_id,
905
+ 'term_taxonomy_id' => $term_relationship['term_taxonomy_id'],
906
+ 'term_order' => $term_relationship['term_order']
907
  ));
908
 
909
  }
944
  'post_modified' => $post_data->post_modified,
945
  'post_modified_gmt' => $post_data->post_modified_gmt,
946
  'post_content_filtered' => $post_data->post_content_filtered,
947
+ 'post_parent' => $post_id, // current post ID
948
  'guid' => $replaced_guid,
949
  'menu_order' => $post_data->menu_order,
950
  'post_type' => $post_data->post_type,
985
  }
986
  }
987
 
988
+ ?>