function exchange_create_tax_for_programme_round($post_id, $post, $update) { $name = $post->post_title; add_taxo('post_tag', $name); }
function exchange_tag_importer() { $fh = fopen(EXCHANGE_PLUGIN_PATH . 'assets/taxonomies.csv', 'r'); if ($fh) { $line = 0; // 1 $headers = array(); while (($row = fgetcsv($fh)) !== false) { // csv headings, so continue/ignore this iteration: if ($line == 0) { // 2 $headers = $row; $line++; // 3 continue; // 4 } $col = 0; $cid = $row[0]; $arr = array(); foreach ($row as $term) { if (!empty($term) && $col > 0) { $tax = explode('_', $headers[$col])[0]; echo $cid . ': ' . $tax . ': ' . $term . '<br />'; $arr[$tax][] = $term; echo add_taxo($tax, $term); add_term_to_cid($cid, $arr); } $col++; } // Keep logic here to add to database, line 1 onwards } } fclose($fh); }