$terms = array('Audio','CD','Download','DVD','Publication','Website');
foreach( $terms as $term ) {
//intert the term
wp_insert_term(
$term, // the term
'media-type' // the taxonomy
);
}
If it is possible I would also like these terms to be the only terms and prevent the user from adding more.
Thanks.
My mistake i didn't initiate a function.
function insert_terms() {
$terms = array('Audio','CD','Download','DVD','Publication','Website');
foreach( $terms as $term ) {
//intert the term
wp_insert_term(
$term, // the term
'media-type' // the taxonomy
);
}
}
add_action( 'init', 'insert_terms' );
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.