[ad_1]
The most recent plugin I found was from 9 years ago.
what’s the easiest way to bulk create categories ?
Just mostly bulk posts when Googling.
Thanks
[ad_2]Copyright © 2020 - 2022, Project DMC - WordPress Tutorials for Beginners- All Rights Reserved. Privacy Policy
Code?
$categories = array(‘Category 1’, ‘Category 2’, ‘Category 3’);
foreach ($categories as $category_name) {
if (!term_exists($category_name, ‘category’)) {
$args = array(
‘description’ => ‘Description for ‘ . $category_name, // Optional.
‘slug’ => sanitize_title($category_name) // Optional.
);
// Insert category.
wp_insert_term($category_name, ‘category’, $args);
}
}
Why would you need to create them in bulk? Categories are useless without having posts attached to them.