Warning: include_once(/home4/aquapan/public_html/cjbarnaby/wp-content/plugins/wp-super-cache/wp-cache-phase1.php): failed to open stream: No such file or directory in /home/revela25/public_html/cjbarnaby/wp-content/advanced-cache.php on line 22

Warning: include_once(): Failed opening '/home4/aquapan/public_html/cjbarnaby/wp-content/plugins/wp-super-cache/wp-cache-phase1.php' for inclusion (include_path='.:/opt/cpanel/ea-php74/root/usr/share/pear') in /home/revela25/public_html/cjbarnaby/wp-content/advanced-cache.php on line 22

Warning: include(/home4/aquapan/public_html/cjbarnaby/wp-content/plugins/wp-super-cache/wp-cache-base.php): failed to open stream: No such file or directory in /home/revela25/public_html/cjbarnaby/wp-content/plugins/wp-super-cache/wp-cache.php on line 137

Warning: include(): Failed opening '/home4/aquapan/public_html/cjbarnaby/wp-content/plugins/wp-super-cache/wp-cache-base.php' for inclusion (include_path='.:/opt/cpanel/ea-php74/root/usr/share/pear') in /home/revela25/public_html/cjbarnaby/wp-content/plugins/wp-super-cache/wp-cache.php on line 137

Warning: include_once(/home4/aquapan/public_html/cjbarnaby/wp-content/plugins/wp-super-cache/ossdl-cdn.php): failed to open stream: No such file or directory in /home/revela25/public_html/cjbarnaby/wp-content/plugins/wp-super-cache/wp-cache.php on line 174

Warning: include_once(): Failed opening '/home4/aquapan/public_html/cjbarnaby/wp-content/plugins/wp-super-cache/ossdl-cdn.php' for inclusion (include_path='.:/opt/cpanel/ea-php74/root/usr/share/pear') in /home/revela25/public_html/cjbarnaby/wp-content/plugins/wp-super-cache/wp-cache.php on line 174

Warning: Cannot modify header information - headers already sent by (output started at /home/revela25/public_html/cjbarnaby/wp-content/advanced-cache.php:22) in /home/revela25/public_html/cjbarnaby/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home/revela25/public_html/cjbarnaby/wp-content/advanced-cache.php:22) in /home/revela25/public_html/cjbarnaby/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home/revela25/public_html/cjbarnaby/wp-content/advanced-cache.php:22) in /home/revela25/public_html/cjbarnaby/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home/revela25/public_html/cjbarnaby/wp-content/advanced-cache.php:22) in /home/revela25/public_html/cjbarnaby/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home/revela25/public_html/cjbarnaby/wp-content/advanced-cache.php:22) in /home/revela25/public_html/cjbarnaby/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home/revela25/public_html/cjbarnaby/wp-content/advanced-cache.php:22) in /home/revela25/public_html/cjbarnaby/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home/revela25/public_html/cjbarnaby/wp-content/advanced-cache.php:22) in /home/revela25/public_html/cjbarnaby/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home/revela25/public_html/cjbarnaby/wp-content/advanced-cache.php:22) in /home/revela25/public_html/cjbarnaby/wp-includes/rest-api/class-wp-rest-server.php on line 1893
{"id":3991,"date":"2023-03-07T01:36:35","date_gmt":"2023-03-07T01:36:35","guid":{"rendered":"http:\/\/cjbarnaby.com\/?p=3991"},"modified":"2023-03-07T01:37:11","modified_gmt":"2023-03-07T01:37:11","slug":"copy-post-categories-to-woocommerce-categories","status":"publish","type":"post","link":"http:\/\/cjbarnaby.com\/copy-post-categories-to-woocommerce-categories\/","title":{"rendered":"Copy Post Categories To Woocommerce Categories"},"content":{"rendered":"\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\tThis was a time saver thanks to AI helper.\r\n\r\nUse at your own risk.\r\n\r\n \t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\t\n\n\/\/ category post to product copy specific id's\n\nfunction copy_specific_post_categories_to_product_categories() {\n    $args = array(\n        'taxonomy' => 'category',\n        'orderby' => 'name',\n        'order' => 'ASC',\n        'hide_empty' => false,\n        'include' => array(76,77,78,79,80,81,82,83,87,88,89,90,91,91,92,93,94,95) \/\/ Add the category IDs you want to copy here\n    );\n\n    $post_categories = get_categories($args);\n\n    foreach ($post_categories as $post_category) {\n        $parent_id = $post_category->parent;\n        $cat_args = array(\n            'name' => $post_category->name,\n            'description' => $post_category->description,\n            'slug' => $post_category->slug,\n            'parent' => 0,\n        );\n        $cat_id = wp_insert_term($post_category->name, 'product_cat', $cat_args);\n\n        if (!is_wp_error($cat_id)) {\n            if ($parent_id > 0) {\n                $parent_term = get_term_by('id', $parent_id, 'product_cat');\n                if ($parent_term) {\n                    wp_update_term($cat_id['term_id'], 'product_cat', array('parent' => $parent_term->term_id));\n                }\n            }\n        }\n    }\n}\n\nadd_action( 'init', 'copy_specific_post_categories_to_product_categories' );\n\/\/\n\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>This was a time saver thanks to AI helper. Use at your own risk. &nbsp; \/\/ category post to product copy specific id&#8217;s function copy_specific_post_categories_to_product_categories() { $args = array( &#8216;taxonomy&#8217; => &#8216;category&#8217;, &#8216;orderby&#8217; => &#8216;name&#8217;, &#8216;order&#8217; => &#8216;ASC&#8217;, &#8216;hide_empty&#8217; => false, &#8216;include&#8217; => array(76,77,78,79,80,81,82,83,87,88,89,90,91,91,92,93,94,95) \/\/ Add the category IDs you want to copy here ); [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3991","post","type-post","status-publish","format-standard","hentry","category-attachments"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Copy Post Categories To Woocommerce Categories - cjbarnaby<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cjbarnaby.com\/copy-post-categories-to-woocommerce-categories\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Copy Post Categories To Woocommerce Categories - cjbarnaby\" \/>\n<meta property=\"og:description\" content=\"This was a time saver thanks to AI helper. Use at your own risk. &nbsp; \/\/ category post to product copy specific id&#039;s function copy_specific_post_categories_to_product_categories() { $args = array( &#039;taxonomy&#039; =&gt; &#039;category&#039;, &#039;orderby&#039; =&gt; &#039;name&#039;, &#039;order&#039; =&gt; &#039;ASC&#039;, &#039;hide_empty&#039; =&gt; false, &#039;include&#039; =&gt; array(76,77,78,79,80,81,82,83,87,88,89,90,91,91,92,93,94,95) \/\/ Add the category IDs you want to copy here ); [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cjbarnaby.com\/copy-post-categories-to-woocommerce-categories\/\" \/>\n<meta property=\"og:site_name\" content=\"cjbarnaby\" \/>\n<meta property=\"article:published_time\" content=\"2023-03-07T01:36:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-03-07T01:37:11+00:00\" \/>\n<meta name=\"author\" content=\"cjbarnaby\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"cjbarnaby\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cjbarnaby.com\/copy-post-categories-to-woocommerce-categories\/\",\"url\":\"https:\/\/cjbarnaby.com\/copy-post-categories-to-woocommerce-categories\/\",\"name\":\"Copy Post Categories To Woocommerce Categories - cjbarnaby\",\"isPartOf\":{\"@id\":\"http:\/\/cjbarnaby.com\/#website\"},\"datePublished\":\"2023-03-07T01:36:35+00:00\",\"dateModified\":\"2023-03-07T01:37:11+00:00\",\"author\":{\"@id\":\"http:\/\/cjbarnaby.com\/#\/schema\/person\/c480873ae8f074e8a2ba01f1e7c020f7\"},\"breadcrumb\":{\"@id\":\"https:\/\/cjbarnaby.com\/copy-post-categories-to-woocommerce-categories\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cjbarnaby.com\/copy-post-categories-to-woocommerce-categories\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cjbarnaby.com\/copy-post-categories-to-woocommerce-categories\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/cjbarnaby.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Copy Post Categories To Woocommerce Categories\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/cjbarnaby.com\/#website\",\"url\":\"http:\/\/cjbarnaby.com\/\",\"name\":\"cjbarnaby\",\"description\":\"life attachments = temporal meaning\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/cjbarnaby.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"http:\/\/cjbarnaby.com\/#\/schema\/person\/c480873ae8f074e8a2ba01f1e7c020f7\",\"name\":\"cjbarnaby\",\"url\":\"http:\/\/cjbarnaby.com\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Copy Post Categories To Woocommerce Categories - cjbarnaby","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cjbarnaby.com\/copy-post-categories-to-woocommerce-categories\/","og_locale":"en_US","og_type":"article","og_title":"Copy Post Categories To Woocommerce Categories - cjbarnaby","og_description":"This was a time saver thanks to AI helper. Use at your own risk. &nbsp; \/\/ category post to product copy specific id's function copy_specific_post_categories_to_product_categories() { $args = array( 'taxonomy' => 'category', 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => false, 'include' => array(76,77,78,79,80,81,82,83,87,88,89,90,91,91,92,93,94,95) \/\/ Add the category IDs you want to copy here ); [&hellip;]","og_url":"https:\/\/cjbarnaby.com\/copy-post-categories-to-woocommerce-categories\/","og_site_name":"cjbarnaby","article_published_time":"2023-03-07T01:36:35+00:00","article_modified_time":"2023-03-07T01:37:11+00:00","author":"cjbarnaby","twitter_card":"summary_large_image","twitter_misc":{"Written by":"cjbarnaby","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/cjbarnaby.com\/copy-post-categories-to-woocommerce-categories\/","url":"https:\/\/cjbarnaby.com\/copy-post-categories-to-woocommerce-categories\/","name":"Copy Post Categories To Woocommerce Categories - cjbarnaby","isPartOf":{"@id":"http:\/\/cjbarnaby.com\/#website"},"datePublished":"2023-03-07T01:36:35+00:00","dateModified":"2023-03-07T01:37:11+00:00","author":{"@id":"http:\/\/cjbarnaby.com\/#\/schema\/person\/c480873ae8f074e8a2ba01f1e7c020f7"},"breadcrumb":{"@id":"https:\/\/cjbarnaby.com\/copy-post-categories-to-woocommerce-categories\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cjbarnaby.com\/copy-post-categories-to-woocommerce-categories\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/cjbarnaby.com\/copy-post-categories-to-woocommerce-categories\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/cjbarnaby.com\/"},{"@type":"ListItem","position":2,"name":"Copy Post Categories To Woocommerce Categories"}]},{"@type":"WebSite","@id":"http:\/\/cjbarnaby.com\/#website","url":"http:\/\/cjbarnaby.com\/","name":"cjbarnaby","description":"life attachments = temporal meaning","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/cjbarnaby.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"http:\/\/cjbarnaby.com\/#\/schema\/person\/c480873ae8f074e8a2ba01f1e7c020f7","name":"cjbarnaby","url":"http:\/\/cjbarnaby.com\/author\/admin\/"}]}},"_links":{"self":[{"href":"http:\/\/cjbarnaby.com\/wp-json\/wp\/v2\/posts\/3991","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/cjbarnaby.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/cjbarnaby.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/cjbarnaby.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/cjbarnaby.com\/wp-json\/wp\/v2\/comments?post=3991"}],"version-history":[{"count":5,"href":"http:\/\/cjbarnaby.com\/wp-json\/wp\/v2\/posts\/3991\/revisions"}],"predecessor-version":[{"id":3996,"href":"http:\/\/cjbarnaby.com\/wp-json\/wp\/v2\/posts\/3991\/revisions\/3996"}],"wp:attachment":[{"href":"http:\/\/cjbarnaby.com\/wp-json\/wp\/v2\/media?parent=3991"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/cjbarnaby.com\/wp-json\/wp\/v2\/categories?post=3991"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/cjbarnaby.com\/wp-json\/wp\/v2\/tags?post=3991"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}