add_action ('init', 'general_parent_cat'); function general_parent_cat() { $parent_cat_id = 1; // change 1 to the ID of the parent category $categories=get_categories(array('exclude' => $parent_cat_id, 'taxonomy' => 'category')); foreach($categories as $category) { // only if a category doesn't have a parent if (!$category->category_parent) { wp_update_term($category->term_id, 'category', array('parent' => $parent_cat_id)); } } }
There are currently 1 users browsing this thread. (0 members and 1 guests)