The function below is supposed to fire when the theme it belongs to is activated. However, to get it to actually create the categories inside the conditional, I'm having to (1) activate the theme, (2) Activate any other theme (3) Activate the theme again
What gives, it should process upon the first time its activated.
// with activate make sure utility categories are created and parented correctly
if ( is_admin() && isset($_GET['activated'] ) && $pagenow == 'themes.php' ) {
if (file_exists(ABSPATH.'/wp-admin/includes/taxonomy.php'))
{
require_once(ABSPATH.'/wp-admin/includes/taxonomy.php');
wp_create_category('nofollow');
$myCategory1['cat_ID'] = get_cat_id('nofollow');
$myCategory1['category_parent'] = 1;
wp_update_category($myCategory1);
wp_create_category('noindex');
$myCategory2['cat_ID'] = get_cat_id('noindex');
$myCategory2['category_parent'] = 1;
wp_update_category($myCategory2);
}
}