Project

General

Profile

Feature #11298 » cac-create-disciplinary-cluster-terms.php

Boone Gorges, 2019-10-30 10:06 PM

 
1
<?php
2

    
3
$clusters = cac_get_disciplinary_clusters();
4
$taxonomy = 'cac_course_disciplinary_cluster';
5

    
6
foreach ( $clusters as $slug => $name ) {
7
	// Don't recreate.
8
	$existing = get_term_by( 'slug', $slug, $taxonomy );
9
	if ( $existing ) {
10
		continue;
11
	}
12

    
13
	$inserted = wp_insert_term(
14
		$name,
15
		$taxonomy,
16
		[
17
			'slug' => $slug,
18
		]
19
	);
20
	var_Dump( $inserted );
21
}
(18-18/20)