{"id":13881,"date":"2023-01-15T14:23:09","date_gmt":"2023-01-15T13:23:09","guid":{"rendered":"https:\/\/www.welaunch.io\/en\/?post_type=faq&#038;p=13881"},"modified":"2023-03-21T20:56:12","modified_gmt":"2023-03-21T19:56:12","slug":"import-custom-product-tabs-using-wp-all-import","status":"publish","type":"faq","link":"https:\/\/www.welaunch.io\/en\/knowledge-base\/faq\/import-custom-product-tabs-using-wp-all-import\/","title":{"rendered":"Import Custom Product Tabs using WP All Import"},"content":{"rendered":"<p>When using our <a href=\"https:\/\/www.welaunch.io\/en\/product\/woocommerce-ultimate-tabs\/\">custom product tabs for WooCommerce plugin<\/a> you can add custom tabs yourself, but you can also use WP All Import for importing multiple tab content data. In this guide we show how you can use an import job of WPAI to update custom tabs with ease.<\/p>\n<p>Inside custom Fields settings of your import job create anew entry with<\/p>\n<ul>\n<li>Name: woocommerce_ultimate_tabs_custom<\/li>\n<li>Value -&gt; click on field options &gt; serialized\n<ul>\n<li>Key: 1, 2, 3, 4 etc.<\/li>\n<li>Value: custom callback function:\u00a0<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre>[we_serialize_tab( {dataTabTitle[1]}, {dataTabDescription[1]}, \"50\")]<\/pre>\n\t<div class=\"img has-hover x md-x lg-x y md-y lg-y\" id=\"image_803513456\">\n\t\t<a class=\"image-lightbox lightbox-gallery\" title=\"\" href=\"https:\/\/www.welaunch.io\/en\/wp-content\/uploads\/sites\/8\/2023\/01\/wp-all-import-custom-fields-for-woocommerce-product-tabs-1-1024x261.png\">\t\t\t\t\t\t<div class=\"img-inner box-shadow-2 dark\" >\n\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"1020\" height=\"260\" src=\"https:\/\/www.welaunch.io\/en\/wp-content\/uploads\/sites\/8\/2023\/01\/wp-all-import-custom-fields-for-woocommerce-product-tabs-1-1024x261.png\" class=\"attachment-large size-large\" alt=\"wp all import custom fields for woocommerce product tabs\" srcset=\"https:\/\/www.welaunch.io\/en\/wp-content\/uploads\/sites\/8\/2023\/01\/wp-all-import-custom-fields-for-woocommerce-product-tabs-1-1024x261.png 1024w, https:\/\/www.welaunch.io\/en\/wp-content\/uploads\/sites\/8\/2023\/01\/wp-all-import-custom-fields-for-woocommerce-product-tabs-1-300x76.png 300w, https:\/\/www.welaunch.io\/en\/wp-content\/uploads\/sites\/8\/2023\/01\/wp-all-import-custom-fields-for-woocommerce-product-tabs-1-768x196.png 768w, https:\/\/www.welaunch.io\/en\/wp-content\/uploads\/sites\/8\/2023\/01\/wp-all-import-custom-fields-for-woocommerce-product-tabs-1-1536x391.png 1536w, https:\/\/www.welaunch.io\/en\/wp-content\/uploads\/sites\/8\/2023\/01\/wp-all-import-custom-fields-for-woocommerce-product-tabs-1-2048x522.png 2048w, https:\/\/www.welaunch.io\/en\/wp-content\/uploads\/sites\/8\/2023\/01\/wp-all-import-custom-fields-for-woocommerce-product-tabs-1-600x153.png 600w, https:\/\/www.welaunch.io\/en\/wp-content\/uploads\/sites\/8\/2023\/01\/wp-all-import-custom-fields-for-woocommerce-product-tabs-1-510x130.png 510w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/>\t\t\t\t\t\t\n\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/a>\t\t\n<style>\n#image_803513456 {\n  width: 100%;\n}\n<\/style>\n\t<\/div>\n\t\n\t<div id=\"gap-1264732219\" class=\"gap-element clearfix\" style=\"display:block; height:auto;\">\n\t\t\n<style>\n#gap-1264732219 {\n  padding-top: 30px;\n}\n<\/style>\n\t<\/div>\n\t\n<p>The above custom callback function needs to be added to the importer functions. Open the fucntion editor and add the function code (see below).<\/p>\n<pre>function we_serialize_tab($title, $content, $priority = 20)\n{\n\tif(empty($title)) {\n\t\treturn '';\n\t}\n\n\tif(empty($content)) {\n\t\treturn '';\n\t}\n\n\t$priority = intval($priority);\n\n\t$data = array(\n\t\t'id' =&gt; uniqid(),\n\t\t'title' =&gt; $title,\n\t\t'content' =&gt; $content,\n\t\t'priority' =&gt; $priority,\n\t);\n\n\treturn serialize($data);\n}\n<\/pre>\n<p>This code will create a serialized object of custom product tab data containing:<\/p>\n<ol>\n<li>unique id (you can also make that static if you want)<\/li>\n<li>title (the tab title)<\/li>\n<li>content (the text that will show in this tab)<\/li>\n<li>priority (default 20)<\/li>\n<\/ol>\n\t<div class=\"img has-hover x md-x lg-x y md-y lg-y\" id=\"image_191879935\">\n\t\t<a class=\"image-lightbox lightbox-gallery\" title=\"\" href=\"https:\/\/www.welaunch.io\/en\/wp-content\/uploads\/sites\/8\/2023\/01\/custom-function-to-import-product-tabs-e1673788865179-1024x554.png\">\t\t\t\t\t\t<div class=\"img-inner box-shadow-2 dark\" >\n\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"1020\" height=\"552\" src=\"https:\/\/www.welaunch.io\/en\/wp-content\/uploads\/sites\/8\/2023\/01\/custom-function-to-import-product-tabs-e1673788865179-1024x554.png\" class=\"attachment-large size-large\" alt=\"custom function to import product tabs\" srcset=\"https:\/\/www.welaunch.io\/en\/wp-content\/uploads\/sites\/8\/2023\/01\/custom-function-to-import-product-tabs-e1673788865179-1024x554.png 1024w, https:\/\/www.welaunch.io\/en\/wp-content\/uploads\/sites\/8\/2023\/01\/custom-function-to-import-product-tabs-e1673788865179-300x162.png 300w, https:\/\/www.welaunch.io\/en\/wp-content\/uploads\/sites\/8\/2023\/01\/custom-function-to-import-product-tabs-e1673788865179-768x416.png 768w, https:\/\/www.welaunch.io\/en\/wp-content\/uploads\/sites\/8\/2023\/01\/custom-function-to-import-product-tabs-e1673788865179-1536x832.png 1536w, https:\/\/www.welaunch.io\/en\/wp-content\/uploads\/sites\/8\/2023\/01\/custom-function-to-import-product-tabs-e1673788865179-2048x1109.png 2048w, https:\/\/www.welaunch.io\/en\/wp-content\/uploads\/sites\/8\/2023\/01\/custom-function-to-import-product-tabs-e1673788865179-600x325.png 600w, https:\/\/www.welaunch.io\/en\/wp-content\/uploads\/sites\/8\/2023\/01\/custom-function-to-import-product-tabs-e1673788865179-510x276.png 510w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/>\t\t\t\t\t\t\n\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/a>\t\t\n<style>\n#image_191879935 {\n  width: 100%;\n}\n<\/style>\n\t<\/div>\n\t\n\t<div id=\"gap-1068035416\" class=\"gap-element clearfix\" style=\"display:block; height:auto;\">\n\t\t\n<style>\n#gap-1068035416 {\n  padding-top: 30px;\n}\n<\/style>\n\t<\/div>\n\t\n<p>Now you can run your <a href=\"https:\/\/www.wpallimport.com\/\" target=\"_blank\" rel=\"noopener\">WP All Import job<\/a> and custom product tabs for your products will be created automatically.\u00a0<\/p>\n","protected":false},"author":1,"featured_media":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","product_cat":[],"class_list":["post-13881","faq","type-faq","status-publish","hentry","faq_topics-ultimate-tabs","faq_topics-ultimate-tabs-faq","faq_topics-ultimate-tabs-filter-hooks"],"_links":{"self":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq\/13881","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq"}],"about":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/types\/faq"}],"author":[{"embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/comments?post=13881"}],"version-history":[{"count":4,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq\/13881\/revisions"}],"predecessor-version":[{"id":14616,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/faq\/13881\/revisions\/14616"}],"wp:attachment":[{"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/media?parent=13881"}],"wp:term":[{"taxonomy":"product_cat","embeddable":true,"href":"https:\/\/www.welaunch.io\/en\/wp-json\/wp\/v2\/product_cat?post=13881"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}