One Click Demo Import - Version 2.1.0

Version Description

Release Date - 8 January 2017

  • Add grid layout import confirmation popup options filter,
  • Fix term meta data double import,
  • Fix WooCommerce product attributes import.
Download this release

Release Info

Developer capuderg
Plugin Icon 128x128 One Click Demo Import
Version 2.1.0
Comparing to
See all releases

Code changes from version 2.0.2 to 2.1.0

assets/js/main.js CHANGED
@@ -215,6 +215,33 @@ jQuery( function ( $ ) {
215
  var previewImageContent = '';
216
  var importNotice = ocdi.import_files[ selectedImportID ]['import_notice'] || '';
217
  var importNoticeContent = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
 
219
  if ( '' === currentFilePreviewImage ) {
220
  previewImageContent = '<p>' + ocdi.texts.missing_preview_image + '</p>';
@@ -236,28 +263,8 @@ jQuery( function ( $ ) {
236
  importNoticeContent
237
  );
238
 
239
- $dialogContiner.dialog( {
240
- 'dialogClass': 'wp-dialog',
241
- 'resizable': false,
242
- 'height': 'auto',
243
- 'modal': true,
244
- 'buttons': [
245
- {
246
- text: ocdi.texts.dialog_no,
247
- click: function() {
248
- $(this).dialog('close');
249
- }
250
- },
251
- {
252
- text: ocdi.texts.dialog_yes,
253
- class: 'button button-primary',
254
- click: function() {
255
- $(this).dialog('close');
256
- gridLayoutImport( selectedImportID, $itemContainer );
257
- }
258
- }
259
- ]
260
- } );
261
  }
262
 
263
  /**
215
  var previewImageContent = '';
216
  var importNotice = ocdi.import_files[ selectedImportID ]['import_notice'] || '';
217
  var importNoticeContent = '';
218
+ var dialogOptions = $.extend(
219
+ {
220
+ 'dialogClass': 'wp-dialog',
221
+ 'resizable': false,
222
+ 'height': 'auto',
223
+ 'modal': true
224
+ },
225
+ ocdi.dialog_options,
226
+ {
227
+ 'buttons':
228
+ [
229
+ {
230
+ text: ocdi.texts.dialog_no,
231
+ click: function() {
232
+ $(this).dialog('close');
233
+ }
234
+ },
235
+ {
236
+ text: ocdi.texts.dialog_yes,
237
+ class: 'button button-primary',
238
+ click: function() {
239
+ $(this).dialog('close');
240
+ gridLayoutImport( selectedImportID, $itemContainer );
241
+ }
242
+ }
243
+ ]
244
+ });
245
 
246
  if ( '' === currentFilePreviewImage ) {
247
  previewImageContent = '<p>' + ocdi.texts.missing_preview_image + '</p>';
263
  importNoticeContent
264
  );
265
 
266
+ // Display the confirmation popup.
267
+ $dialogContiner.dialog( dialogOptions );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
268
  }
269
 
270
  /**
inc/OneClickDemoImport.php CHANGED
@@ -186,6 +186,7 @@ class OneClickDemoImport {
186
  'dialog_yes' => esc_html__( 'Yes, import!', 'pt-ocdi' ),
187
  'selected_import_title' => esc_html__( 'Selected demo import:', 'pt-ocdi' ),
188
  ),
 
189
  )
190
  );
191
 
186
  'dialog_yes' => esc_html__( 'Yes, import!', 'pt-ocdi' ),
187
  'selected_import_title' => esc_html__( 'Selected demo import:', 'pt-ocdi' ),
188
  ),
189
+ 'dialog_options' => apply_filters( 'pt-ocdi/confirmation_dialog_options', array() )
190
  )
191
  );
192
 
inc/WXRImporter.php CHANGED
@@ -22,6 +22,11 @@ class WXRImporter extends \ProteusThemes\WPContentImporter2\WXRImporter {
22
  // Fixes the [WARNING] Could not find the author for ... log warning messages.
23
  $current_user_obj = wp_get_current_user();
24
  $this->mapping['user_slug'][ $current_user_obj->user_login ] = $current_user_obj->ID;
 
 
 
 
 
25
  }
26
 
27
  /**
@@ -51,4 +56,55 @@ class WXRImporter extends \ProteusThemes\WPContentImporter2\WXRImporter {
51
  $this->url_remap = empty( $data['url_remap'] ) ? array() : $data['url_remap'];
52
  $this->featured_images = empty( $data['featured_images'] ) ? array() : $data['featured_images'];
53
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  }
22
  // Fixes the [WARNING] Could not find the author for ... log warning messages.
23
  $current_user_obj = wp_get_current_user();
24
  $this->mapping['user_slug'][ $current_user_obj->user_login ] = $current_user_obj->ID;
25
+
26
+ // WooCommerce product attributes registration.
27
+ if ( class_exists( 'WooCommerce' ) ) {
28
+ add_filter( 'wxr_importer.pre_process.term', array( $this, 'woocommerce_product_attributes_registration' ), 10, 1 );
29
+ }
30
  }
31
 
32
  /**
56
  $this->url_remap = empty( $data['url_remap'] ) ? array() : $data['url_remap'];
57
  $this->featured_images = empty( $data['featured_images'] ) ? array() : $data['featured_images'];
58
  }
59
+
60
+ /**
61
+ * Hook into the pre-process term filter of the content import and register the
62
+ * custom WooCommerce product attributes, so that the terms can then be imported normally.
63
+ *
64
+ * This should probably be removed once the WP importer 2.0 support is added in WooCommerce.
65
+ *
66
+ * Fixes: [WARNING] Failed to import pa_size L warnings in content import.
67
+ * Code from: woocommerce/includes/admin/class-wc-admin-importers.php (ver 2.6.9).
68
+ *
69
+ * Github issue: https://github.com/proteusthemes/one-click-demo-import/issues/71
70
+ *
71
+ * @param array $date The term data to import.
72
+ * @return array The unchanged term data.
73
+ */
74
+ public function woocommerce_product_attributes_registration( $data ) {
75
+ global $wpdb;
76
+
77
+ if ( strstr( $data['taxonomy'], 'pa_' ) ) {
78
+ if ( ! taxonomy_exists( $data['taxonomy'] ) ) {
79
+ $attribute_name = wc_sanitize_taxonomy_name( str_replace( 'pa_', '', $data['taxonomy'] ) );
80
+
81
+ // Create the taxonomy
82
+ if ( ! in_array( $attribute_name, wc_get_attribute_taxonomies() ) ) {
83
+ $attribute = array(
84
+ 'attribute_label' => $attribute_name,
85
+ 'attribute_name' => $attribute_name,
86
+ 'attribute_type' => 'select',
87
+ 'attribute_orderby' => 'menu_order',
88
+ 'attribute_public' => 0
89
+ );
90
+ $wpdb->insert( $wpdb->prefix . 'woocommerce_attribute_taxonomies', $attribute );
91
+ delete_transient( 'wc_attribute_taxonomies' );
92
+ }
93
+
94
+ // Register the taxonomy now so that the import works!
95
+ register_taxonomy(
96
+ $data['taxonomy'],
97
+ apply_filters( 'woocommerce_taxonomy_objects_' . $data['taxonomy'], array( 'product' ) ),
98
+ apply_filters( 'woocommerce_taxonomy_args_' . $data['taxonomy'], array(
99
+ 'hierarchical' => true,
100
+ 'show_ui' => false,
101
+ 'query_var' => true,
102
+ 'rewrite' => false,
103
+ ) )
104
+ );
105
+ }
106
+ }
107
+
108
+ return $data;
109
+ }
110
  }
languages/pt-ocdi.pot CHANGED
@@ -1,14 +1,14 @@
1
- # Copyright (C) 2016 ProteusThemes
2
  # This file is distributed under the GPL 2.0.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: One Click Demo Import 2.0.2\n"
6
  "Report-Msgid-Bugs-To: http://support.proteusthemes.com/\n"
7
  "POT-Creation-Date: 2016-05-14 09:53:17+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
  "X-Generator: grunt-wp-i18n 0.5.4\n"
@@ -179,23 +179,23 @@ msgstr ""
179
  msgid "Selected demo import:"
180
  msgstr ""
181
 
182
- #: inc/OneClickDemoImport.php:233
183
  msgid "Manually uploaded files"
184
  msgstr ""
185
 
186
- #: inc/OneClickDemoImport.php:246 inc/OneClickDemoImport.php:257
187
  msgid "Downloaded files"
188
  msgstr ""
189
 
190
- #: inc/OneClickDemoImport.php:253
191
  msgid "The import files for: %s were successfully downloaded!"
192
  msgstr ""
193
 
194
- #: inc/OneClickDemoImport.php:262
195
  msgid "No import files specified!"
196
  msgstr ""
197
 
198
- #: inc/OneClickDemoImport.php:379
199
  msgid ""
200
  "%1$s%3$sThat's it, all done!%4$s%2$sThe demo import has finished. Please "
201
  "check your page and make sure that everything has imported correctly. If it "
@@ -203,7 +203,7 @@ msgid ""
203
  "it has done its job.%5$s"
204
  msgstr ""
205
 
206
- #: inc/OneClickDemoImport.php:390
207
  msgid ""
208
  "%1$sThe demo import has finished, but there were some import "
209
  "errors.%2$sMore details about the errors can be found in this %3$s%5$slog "
1
+ # Copyright (C) 2017 ProteusThemes
2
  # This file is distributed under the GPL 2.0.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: One Click Demo Import 2.1.0\n"
6
  "Report-Msgid-Bugs-To: http://support.proteusthemes.com/\n"
7
  "POT-Creation-Date: 2016-05-14 09:53:17+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
  "X-Generator: grunt-wp-i18n 0.5.4\n"
179
  msgid "Selected demo import:"
180
  msgstr ""
181
 
182
+ #: inc/OneClickDemoImport.php:234
183
  msgid "Manually uploaded files"
184
  msgstr ""
185
 
186
+ #: inc/OneClickDemoImport.php:247 inc/OneClickDemoImport.php:258
187
  msgid "Downloaded files"
188
  msgstr ""
189
 
190
+ #: inc/OneClickDemoImport.php:254
191
  msgid "The import files for: %s were successfully downloaded!"
192
  msgstr ""
193
 
194
+ #: inc/OneClickDemoImport.php:263
195
  msgid "No import files specified!"
196
  msgstr ""
197
 
198
+ #: inc/OneClickDemoImport.php:380
199
  msgid ""
200
  "%1$s%3$sThat's it, all done!%4$s%2$sThe demo import has finished. Please "
201
  "check your page and make sure that everything has imported correctly. If it "
203
  "it has done its job.%5$s"
204
  msgstr ""
205
 
206
+ #: inc/OneClickDemoImport.php:391
207
  msgid ""
208
  "%1$sThe demo import has finished, but there were some import "
209
  "errors.%2$sMore details about the errors can be found in this %3$s%5$slog "
one-click-demo-import.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: One Click Demo Import
5
  Plugin URI: https://wordpress.org/plugins/one-click-demo-import/
6
  Description: Import your content, widgets and theme settings with one click. Theme authors! Enable simple demo import for your theme demo data.
7
- Version: 2.0.2
8
  Author: ProteusThemes
9
  Author URI: http://www.proteusthemes.com
10
  License: GPL3
4
  Plugin Name: One Click Demo Import
5
  Plugin URI: https://wordpress.org/plugins/one-click-demo-import/
6
  Description: Import your content, widgets and theme settings with one click. Theme authors! Enable simple demo import for your theme demo data.
7
+ Version: 2.1.0
8
  Author: ProteusThemes
9
  Author URI: http://www.proteusthemes.com
10
  License: GPL3
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: capuderg, cyman, Prelc
3
  Tags: import, content, demo, data, widgets, settings
4
  Requires at least: 4.0.0
5
  Tested up to: 4.7
6
- Stable tag: 2.0.2
7
  License: GPLv3 or later
8
 
9
  Import your demo content, widgets and theme settings with one click. Theme authors! Enable simple demo import for your theme demo data.
@@ -281,6 +281,27 @@ It's easy, just add this to your theme:
281
  This will enable the following WP hooks when importing the customizer data: `customize_save`, `customize_save_*`, `customize_save_after`.
282
 
283
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284
  = I can't activate the plugin, because of a fatal error, what can I do? =
285
 
286
  *Update: since version 1.2.0, there is now a admin error notice, stating that the minimal PHP version required for this plugin is 5.3.2.*
@@ -303,17 +324,25 @@ Please visit this [docs page](https://github.com/proteusthemes/one-click-demo-im
303
 
304
  == Changelog ==
305
 
 
 
 
 
 
 
 
 
306
  = 2.0.2 =
307
 
308
  *Release Date - 13 December 2016*
309
 
310
- * Fixed issue with customizer options import
311
 
312
  = 2.0.1 =
313
 
314
  *Release Date - 12 December 2016*
315
 
316
- * Fixed issue with some browsers (Safari and IE) not supporting some FormData methods.
317
 
318
  = 2.0.0 =
319
 
3
  Tags: import, content, demo, data, widgets, settings
4
  Requires at least: 4.0.0
5
  Tested up to: 4.7
6
+ Stable tag: 2.1.0
7
  License: GPLv3 or later
8
 
9
  Import your demo content, widgets and theme settings with one click. Theme authors! Enable simple demo import for your theme demo data.
281
  This will enable the following WP hooks when importing the customizer data: `customize_save`, `customize_save_*`, `customize_save_after`.
282
 
283
 
284
+ = How to configure the multi grid layout import popup confirmation? =
285
+
286
+ If you want to disable the popup confirmation modal window, use this filter:
287
+
288
+ `add_filter( 'pt-ocdi/enable_grid_layout_import_popup_confirmation', '__return_false' );`
289
+
290
+ If you want to just change some options for the jQuery modal window we use for the popup confirmation, then use this filter:
291
+
292
+ `
293
+ function my_theme_ocdi_confirmation_dialog_options ( $options ) {
294
+ return array_merge( $options, array(
295
+ 'width' => 300,
296
+ 'dialogClass' => 'wp-dialog',
297
+ 'resizable' => false,
298
+ 'height' => 'auto',
299
+ 'modal' => true,
300
+ ) );
301
+ }
302
+ add_filter( 'pt-ocdi/confirmation_dialog_options', 'my_theme_ocdi_confirmation_dialog_options', 10, 1 );
303
+ `
304
+
305
  = I can't activate the plugin, because of a fatal error, what can I do? =
306
 
307
  *Update: since version 1.2.0, there is now a admin error notice, stating that the minimal PHP version required for this plugin is 5.3.2.*
324
 
325
  == Changelog ==
326
 
327
+ = 2.1.0 =
328
+
329
+ *Release Date - 8 January 2017*
330
+
331
+ * Add grid layout import confirmation popup options filter,
332
+ * Fix term meta data double import,
333
+ * Fix WooCommerce product attributes import.
334
+
335
  = 2.0.2 =
336
 
337
  *Release Date - 13 December 2016*
338
 
339
+ * Fix issue with customizer options import
340
 
341
  = 2.0.1 =
342
 
343
  *Release Date - 12 December 2016*
344
 
345
+ * Fix issue with some browsers (Safari and IE) not supporting some FormData methods.
346
 
347
  = 2.0.0 =
348
 
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit9f19bd79f9d433b9a67432d43819d4ce::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit420861e363096c7f11a9cfa72301a53d::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit9f19bd79f9d433b9a67432d43819d4ce
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit9f19bd79f9d433b9a67432d43819d4ce
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit9f19bd79f9d433b9a67432d43819d4ce', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit9f19bd79f9d433b9a67432d43819d4ce', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
- call_user_func(\Composer\Autoload\ComposerStaticInit9f19bd79f9d433b9a67432d43819d4ce::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit420861e363096c7f11a9cfa72301a53d
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit420861e363096c7f11a9cfa72301a53d', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit420861e363096c7f11a9cfa72301a53d', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit420861e363096c7f11a9cfa72301a53d::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit9f19bd79f9d433b9a67432d43819d4ce
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'P' =>
@@ -31,8 +31,8 @@ class ComposerStaticInit9f19bd79f9d433b9a67432d43819d4ce
31
  public static function getInitializer(ClassLoader $loader)
32
  {
33
  return \Closure::bind(function () use ($loader) {
34
- $loader->prefixLengthsPsr4 = ComposerStaticInit9f19bd79f9d433b9a67432d43819d4ce::$prefixLengthsPsr4;
35
- $loader->prefixDirsPsr4 = ComposerStaticInit9f19bd79f9d433b9a67432d43819d4ce::$prefixDirsPsr4;
36
 
37
  }, null, ClassLoader::class);
38
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit420861e363096c7f11a9cfa72301a53d
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'P' =>
31
  public static function getInitializer(ClassLoader $loader)
32
  {
33
  return \Closure::bind(function () use ($loader) {
34
+ $loader->prefixLengthsPsr4 = ComposerStaticInit420861e363096c7f11a9cfa72301a53d::$prefixLengthsPsr4;
35
+ $loader->prefixDirsPsr4 = ComposerStaticInit420861e363096c7f11a9cfa72301a53d::$prefixDirsPsr4;
36
 
37
  }, null, ClassLoader::class);
38
  }
vendor/composer/installed.json CHANGED
@@ -1,20 +1,20 @@
1
  [
2
  {
3
  "name": "proteusthemes/wp-content-importer-v2",
4
- "version": "v0.4.0",
5
- "version_normalized": "0.4.0.0",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/proteusthemes/WordPress-Importer.git",
9
- "reference": "7d93b7adbfbf8d7496968d9352dcf948606b1a55"
10
  },
11
  "dist": {
12
  "type": "zip",
13
- "url": "https://api.github.com/repos/proteusthemes/WordPress-Importer/zipball/7d93b7adbfbf8d7496968d9352dcf948606b1a55",
14
- "reference": "7d93b7adbfbf8d7496968d9352dcf948606b1a55",
15
  "shasum": ""
16
  },
17
- "time": "2016-12-01 18:39:14",
18
  "type": "library",
19
  "installation-source": "source",
20
  "autoload": {
@@ -41,7 +41,7 @@
41
  "wp"
42
  ],
43
  "support": {
44
- "source": "https://github.com/proteusthemes/WordPress-Importer/tree/v0.4.0"
45
  }
46
  }
47
  ]
1
  [
2
  {
3
  "name": "proteusthemes/wp-content-importer-v2",
4
+ "version": "v0.4.1",
5
+ "version_normalized": "0.4.1.0",
6
  "source": {
7
  "type": "git",
8
  "url": "https://github.com/proteusthemes/WordPress-Importer.git",
9
+ "reference": "3a46202bc44dc8d2791d681085168cb744691e4d"
10
  },
11
  "dist": {
12
  "type": "zip",
13
+ "url": "https://api.github.com/repos/proteusthemes/WordPress-Importer/zipball/3a46202bc44dc8d2791d681085168cb744691e4d",
14
+ "reference": "3a46202bc44dc8d2791d681085168cb744691e4d",
15
  "shasum": ""
16
  },
17
+ "time": "2017-01-08 09:12:39",
18
  "type": "library",
19
  "installation-source": "source",
20
  "autoload": {
41
  "wp"
42
  ],
43
  "support": {
44
+ "source": "https://github.com/proteusthemes/WordPress-Importer/tree/v0.4.1"
45
  }
46
  }
47
  ]
vendor/proteusthemes/wp-content-importer-v2/src/WXRImporter.php CHANGED
@@ -1767,23 +1767,6 @@ class WXRImporter extends \WP_Importer {
1767
  $this->requires_remapping['term'][ $term_id ] = $data['taxonomy'];
1768
  }
1769
 
1770
- // Insert termmeta, if any, including the flag to remap the parent '_wxr_import_parent'.
1771
- if( ! empty( $meta ) ){
1772
- foreach ( $meta as $meta_item ){
1773
- $result = add_term_meta ( $term_id, $meta_item['key'], $meta_item['value'] );
1774
- if ( is_wp_error( $result ) ) {
1775
- $this->logger->warning( sprintf(
1776
- __( 'Failed to add metakey: %s, metavalue: %s to term_id: %d', 'wordpress-importer' ),
1777
- $meta_item['key'], $meta_item['value'], $term_id ) );
1778
- do_action( 'wxr_importer.process_failed.termmeta', $result, $data, $meta );
1779
- } else {
1780
- $this->logger->debug( sprintf(
1781
- __( 'Meta for term_id %d : %s => %s ; successfully added!', 'wordpress-importer' ),
1782
- $term_id, $meta_key, $meta_value ) );
1783
- }
1784
- }
1785
- }
1786
-
1787
  $this->logger->info( sprintf(
1788
  __( 'Imported "%s" (%s)', 'wordpress-importer' ),
1789
  $data['name'],
@@ -1795,7 +1778,8 @@ class WXRImporter extends \WP_Importer {
1795
  $term_id
1796
  ) );
1797
 
1798
- $this->process_term_meta( $meta, $term_id, $term );
 
1799
 
1800
  do_action( 'wp_import_insert_term', $term_id, $data );
1801
 
@@ -1829,20 +1813,40 @@ class WXRImporter extends \WP_Importer {
1829
  * @param int $term_id Term the meta is attached to.
1830
  */
1831
  $meta_item = apply_filters( 'wxr_importer.pre_process.term_meta', $meta_item, $term_id );
 
1832
  if ( empty( $meta_item ) ) {
1833
- return false;
1834
  }
1835
 
1836
  $key = apply_filters( 'import_term_meta_key', $meta_item['key'], $term_id, $term );
1837
  $value = false;
1838
 
1839
  if ( $key ) {
1840
- // export gets meta straight from the DB so could have a serialized string
1841
  if ( ! $value ) {
1842
  $value = maybe_unserialize( $meta_item['value'] );
1843
  }
1844
 
1845
- add_term_meta( $term_id, $key, $value );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1846
  do_action( 'import_term_meta', $term_id, $key, $value );
1847
  }
1848
  }
1767
  $this->requires_remapping['term'][ $term_id ] = $data['taxonomy'];
1768
  }
1769
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1770
  $this->logger->info( sprintf(
1771
  __( 'Imported "%s" (%s)', 'wordpress-importer' ),
1772
  $data['name'],
1778
  $term_id
1779
  ) );
1780
 
1781
+ // Actuall process of the term meta data.
1782
+ $this->process_term_meta( $meta, $term_id, $data );
1783
 
1784
  do_action( 'wp_import_insert_term', $term_id, $data );
1785
 
1813
  * @param int $term_id Term the meta is attached to.
1814
  */
1815
  $meta_item = apply_filters( 'wxr_importer.pre_process.term_meta', $meta_item, $term_id );
1816
+
1817
  if ( empty( $meta_item ) ) {
1818
+ continue;
1819
  }
1820
 
1821
  $key = apply_filters( 'import_term_meta_key', $meta_item['key'], $term_id, $term );
1822
  $value = false;
1823
 
1824
  if ( $key ) {
1825
+ // Export gets meta straight from the DB so could have a serialized string.
1826
  if ( ! $value ) {
1827
  $value = maybe_unserialize( $meta_item['value'] );
1828
  }
1829
 
1830
+ $result = add_term_meta( $term_id, $key, $value );
1831
+
1832
+ if ( is_wp_error( $result ) ) {
1833
+ $this->logger->warning( sprintf(
1834
+ __( 'Failed to add metakey: %s, metavalue: %s to term_id: %d', 'wordpress-importer' ),
1835
+ $key,
1836
+ $value,
1837
+ $term_id
1838
+ ) );
1839
+ do_action( 'wxr_importer.process_failed.termmeta', $result, $meta_item, $term_id, $term );
1840
+ }
1841
+ else {
1842
+ $this->logger->debug( sprintf(
1843
+ __( 'Meta for term_id %d : %s => %s ; successfully added!', 'wordpress-importer' ),
1844
+ $term_id,
1845
+ $key,
1846
+ $value
1847
+ ) );
1848
+ }
1849
+
1850
  do_action( 'import_term_meta', $term_id, $key, $value );
1851
  }
1852
  }