Skip to content

Instantly share code, notes, and snippets.

@rveitch
Last active December 22, 2015 19:40
Show Gist options
  • Select an option

  • Save rveitch/c63e149e65dbbd839a21 to your computer and use it in GitHub Desktop.

Select an option

Save rveitch/c63e149e65dbbd839a21 to your computer and use it in GitHub Desktop.
Insert Default AreaVoices Post Categories
<?php
/**
* Insert default AreaVoices post categories
*/
function insert_av_post_categories() {
/* Rename the default 'Uncategorized' category */
//wp_update_term(1, 'category', array( 'name' => 'Arts & Entertainment', 'slug' => 'arts-entertainment' ));
wp_insert_term( 'Arts & Entertainment', 'category', array( 'description' => '', 'slug' => 'arts-entertainment' ) );
wp_insert_term( 'Automotive', 'category', array( 'description' => '', 'slug' => 'automotive' ) );
wp_insert_term( 'Business', 'category', array( 'description' => '', 'slug' => 'business' ) );
wp_insert_term( 'Careers', 'category', array( 'description' => '', 'slug' => 'careers' ) );
wp_insert_term( 'Education', 'category', array( 'description' => '', 'slug' => 'education' ) );
wp_insert_term( 'Family & Parenting', 'category', array( 'description' => '', 'slug' => 'family-parenting' ) );
wp_insert_term( 'Food & Drink', 'category', array( 'description' => '', 'slug' => 'food-drink' ) );
wp_insert_term( 'Health & Fitness', 'category', array( 'description' => '', 'slug' => 'health-fitness' ) );
wp_insert_term( 'Hobbies & Interests', 'category', array( 'description' => '', 'slug' => 'hobbies-interests' ) );
wp_insert_term( 'Home & Garden', 'category', array( 'description' => '', 'slug' => 'home-garden' ) );
wp_insert_term( 'Law, Government, Politics', 'category', array( 'description' => '', 'slug' => 'law-government-politics' ) );
wp_insert_term( 'News', 'category', array( 'description' => '', 'slug' => 'news' ) );
wp_insert_term( 'Personal Finance', 'category', array( 'description' => '', 'slug' => 'personal-finance' ) );
wp_insert_term( 'Pets', 'category', array( 'description' => '', 'slug' => 'pets' ) );
wp_insert_term( 'Real Estate', 'category', array( 'description' => '', 'slug' => 'real-estate' ) );
wp_insert_term( 'Religion & Spirituality', 'category', array( 'description' => '', 'slug' => 'religion-spirituality' ) );
wp_insert_term( 'Science', 'category', array( 'description' => '', 'slug' => 'science' ) );
wp_insert_term( 'Shopping', 'category', array( 'description' => '', 'slug' => 'shopping' ) );
wp_insert_term( 'Society', 'category', array( 'description' => '', 'slug' => 'society' ) );
wp_insert_term( 'Sports', 'category', array( 'description' => '', 'slug' => 'sports' ) );
wp_insert_term( 'Style & Fashion', 'category', array( 'description' => '', 'slug' => 'style-fashion' ) );
wp_insert_term( 'Technology & Computing', 'category', array( 'description' => '', 'slug' => 'technology-computing' ) );
wp_insert_term( 'Travel', 'category', array( 'description' => '', 'slug' => 'travel' ) );
//update_option( 'default_category', 2 );
//wp_delete_term($theterm, 'Uncategorized');
}
add_action( 'after_setup_theme', 'insert_av_post_categories' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment