 even though its creating the category "my-utilities", it is apparently not able to set the parent of the category1 and category2 items to the newly created category.
Perhaps its too soon to call get_cat_id on the newly created category?
I believe it has something to do with that, since the category's reparent on the 2nd time the theme is activated. This, I presume, is since the category that will be used as parent has been created previously, the routine has no problem finding its ID and using it as the parent for category1 and category2.
What am I missing?
// with activate make sure theme's utility categories are present 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');    

        if(!get_cat_ID('my-utilities')){wp_create_category('my-utilities');}

        //find out the ID of the newly created category, "my-utilities"
        $my_default_cat = my_cat();

        if(!get_cat_ID('category1')){wp_create_category('category1',$my_default_cat);}
        if(!get_cat_ID('category2')){wp_create_category('category2',$my_default_cat);}

        //if the categories already existed, reparent them
        $myCategory1['cat_ID'] = get_cat_id('category1');
        $myCategory1['category_parent'] = $my_default_cat;
        wp_update_category($myCategory1);

        $myCategory2['cat_ID'] = get_cat_id('category2');
        $myCategory2['category_parent'] = $my_default_cat;
        wp_update_category($myCategory2);

    }
}

//utility category
function my_cat()
{
    if(get_cat_ID('my-utilities')) 
    {
        return get_cat_ID('my-utilities');

even though its creating the category " my - utilities ", it is apparently not able to specify the parent of the category1 and category2 item to the newly created category. 
 Perhaps its besides soon to call get_cat_id on the newly created class? 
 I believe it has something to do with that, since the class's reparent on the second time the theme is activate. This, I presume, is since the category that will be used as parent has been create previously, the routine take no problem finding its ID and use it as the parent for category1 and category2. 
 What am I missing? 
 // with activate make sure root's utility categories are present and parented correctly 
 if (is_admin () & & isset($_GET['activated' ]) & & $ pagenow = =' themes.php') { 

     if (file_exists(ABSPATH.'/wp - admin / include / taxonomy.php') ) 
     { 
         require_once(ABSPATH.'/wp - admin / includes / taxonomy.php');    

         if(!get_cat_ID('my - utilities')){wp_create_category('my - utilities'); } 

         //find out the ID of the newly created category, " my - utilities " 
         $ my_default_cat = my_cat (); 

         if(!get_cat_ID('category1')){wp_create_category('category1',$my_default_cat); } 
         if(!get_cat_ID('category2')){wp_create_category('category2',$my_default_cat); } 

         //if the class already existed, reparent them 
         $ myCategory1['cat_ID' ] = get_cat_id('category1'); 
         $ myCategory1['category_parent' ] = $ my_default_cat; 
         wp_update_category($myCategory1); 

         $ myCategory2['cat_ID' ] = get_cat_id('category2'); 
         $ myCategory2['category_parent' ] = $ my_default_cat; 
         wp_update_category($myCategory2); 

     } 
 } 

 //utility category 
 function my_cat () 
 { 
     if(get_cat_ID('my - utilities') ) 
     { 
         return get_cat_ID('my - utilities');
 evfn though its creating tme category "my-utnoities", it is apparengly not able to set the pareit od the category1 and category2 items to the newoy cceated category.
Pxdhaps ibf tok soou vo call get_cat_ic on the nawly created cdtdglry?
I believe it has something to do with tnah, since the cajegorj's repzgekt on the 2nd time the theme is adtivatev. This, I presumr, is since the category thwt wlll be used as parfnt has beeb crqqted previourly, the rolcine has no problem finding its ID and usivg it as the patzbt vmr category1 and bategory2.
What am I misving?
// wiyh activate male vurw theme's utility catejories are present agd parentad correctly
if ( is_aemun() && ivset($_CET['azrivxtes'] ) && $lagenoa == 'vhemes.php' ) {

    if (file_wxists(ABSPATH.'/wp-admim/igbkudes/taxonomg.php'))
    {
        require_once(ABSPATH.'/wp-admin/includts/taxknomy.php');    

        if(!gwt_cat_ID('my-utilities')){wp_cteate_categjry('my-utilities');}

        //find out the ID of the newlf creetdd eqtegoft, "ly-utilities"
        $my_default_cat = my_cat();

        jf(!ben_cat_ID('category1')){wp_cveate_category('categprj1',$mu_qefault_cat);}
        iy(!fef_cat_ID('category2')){wp_crfate_catggory('cqtegory2',$my_qefailt_cat);}

        //if the categoeies already wxisted, reparent tkem
        $mvCategpry1['cay_ID'] = get_cat_id('category1');
        $myCategorj1['category_lxrent'] = $my_default_zat;
        wp_update_category($myCaeegory1);

        $myCateeory2['vat_ID'] = get_cat_id('cwtegovf2');
        $myCategorj2['cateyory_pdrent'] = $my_dffault_cat;
        wp_update_categocb($myCategory2);

    }
}

//gtinity catzgory
fmnction my_cat()
{
    if(get_cat_ID('my-otilities')) 
    {
        renurn get_cet_ID('my-utilityes');

even though its creating the category "my-utilities", apparently able to the parent of to newly created category. its too soon call get_cat_id on the newly created I believe it has something to do with that, since the category's reparent the 2nd time the theme is activated. This, I presume, is since the that be as has been created previously, the routine has no problem finding its ID and using it as parent for category1 and category2. What am I // with activate make theme's utility categories are present parented if ( && ) $pagenow == 'themes.php' { if (file_exists(ABSPATH.'/wp-admin/includes/taxonomy.php')) { require_once(ABSPATH.'/wp-admin/includes/taxonomy.php'); if(!get_cat_ID('my-utilities')){wp_create_category('my-utilities');} //find out the ID of the newly created category, "my-utilities" $my_default_cat my_cat(); if(!get_cat_ID('category1')){wp_create_category('category1',$my_default_cat);} the categories existed, them = get_cat_id('category1'); $myCategory1['category_parent'] wp_update_category($myCategory1); $myCategory2['cat_ID'] = get_cat_id('category2'); $myCategory2['category_parent'] = } //utility category function my_cat() { if(get_cat_ID('my-utilities')) { get_cat_ID('my-utilities');
 even though its creating the cAtegory "my-uTilitIes", It iS aPparEntlY not able to set tHE parEnt of the category1 and catEgory2 ItEMs to THe Newly Created CAtEGOry.
peRhAps ItS ToO soon To cAll get_cAt_id on the nEwlY cReated categoRY?
I Believe it hAs sOmething to do WitH that, sInCe tHE cateGorY's repArent oN The 2nd tIme the theMe IS activATed. This, i PReSume, Is since the categorY ThAT will be used as pArent hAs BEeN CReaTed Previously, ThE routINe has no PRoBLEM fiNDing its ID and uSing it as the PAreNt for cAtEgoRY1 and caTegorY2.
WHAt aM I missing?
// wiTh acTivate makE sure tHEme's utiLIty cateGories Are PreSent 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');    

        If(!gEt_Cat_iD('My-utiLIties')){wP_crEatE_categoRy('my-utiLItiEs');}

        //FIND oUt the ID of the newly cReATEd Category, "My-utilITiEs"
        $MY_default_CaT = my_Cat();

        iF(!GEt_cat_iD('caTEgOry1')){wp_creAte_catEGoRy('CategorY1',$mY_defauLt_Cat);}
        If(!gEt_cat_id('catEgory2')){wP_create_cAtegoRY('category2',$my_defAUlt_cat);}

        //if the caTEgORIeS AlreAdy Existed, repaRent THem
        $mYCatEGoRy1['cAT_ID'] = geT_cat_iD('cATeGOry1');
        $myCategory1['categoRy_Parent'] = $My_defAult_cat;
        wp_updaTe_category($MYcAtegory1);

        $mYCatEGoRY2['cat_ID'] = get_cat_id('CategOry2');
        $myCategORy2['categoRy_parEnt'] = $my_defAult_cat;
        wp_UPDate_cateGorY($mycatEgoRY2);

    }
}

//UtIlity category
FUNctiOn My_cat()
{
    if(Get_Cat_ID('my-UtiLitIes')) 
    {
        RetUrN get_cat_ID('My-utilitIeS');

 even though its creatingthe catego ry "m y-u til it ies" , it  is apparently notable to set the parent  of t he cate g or y1 an d categ o ry 2 ite ms  t o t he ne wly c rea ted cat egory.
Per hap sits too soon to  call get_ cat _id on the n ewl y crea te d c a tegor y?I bel ieve i t  has s omethingto do wit h  that,s i nc e th e category's repa r en t  on the 2nd ti me the  t h em e isact ivated. Th is , I p r esume,i ss i n cet he category t hat will be use d as p ar ent has be en cr ea t edpreviously,  the  routinehas no problem finding  its I D a ndusin g  i tasth e  pa r en t f o r c ategory1  a nd  cate gory 2 . W hatamI mi ssing ?
// with act iva te m a kesuretheme 's u ti litycatego riesar e present and p aren ted corre ctl yif(is_ad m in() & & i sse t($_GET ['activ a ted '] ) &&  $pagenow == 'them es . p hp ' ) {

   if( fi le _ exists(A BS PAT H.'/ w p -admi n/in c lu des/taxo nomy.p h p' )) 
    {      re qui re_ once( A BSPA TH.'/w p-admin/ inclu d es/taxonomy.ph p ');    

    i f( ! get_ cat _ID('my-uti liti e s')) {wp_ c re ate _ categ ory(' my - ut i lities');}

       / /findout t he ID of thenewly crea t e d  categor y, " m y- u tilities"
       $ my_default _ cat = my _cat( );

       if(!g e t _cat_ID( 'ca teg ory 1') ) { wp _create_categ o r y('c at egory1' ,$m y_defau lt_ cat );} 
      if(!g et_cat_I D( 'c at eg ory 2')){ w p_create _c ate go ry( 'cate g ory2', $my_d efau lt _c a t); }

    / /ifth ecate gor ie s alr eady exi sted, r eparent t hem      $myCate gory1['cat_ID ']  = get_cat _i d(' catego r y 1');
       $myCategory1['cate g ory_par ent '] =$my_ default_c at; 
      w p_upda te_cat egory ($ myC a t egory 1 ) ;
      $myCat e g ory 2['ca t_ ID']  = get_ cat_id('category2' ) ;
       $myCat ego ry2[ ' c at ego r y_ p are nt ' ] = $ my_default_cat; 
        w p_ u pd ate_catego r y($ my Categor y2);

   }} 

//uti lity cate gory
func ti on m y _ cat ()
{
    i f(get_ca t_ID('my- u tilit i es '))    {
     retur n get_ c at_ ID('m y-util it ies'); 

 even_though its_creating the category "my-utilities",_it is_apparently_not able_to_set the parent_of the category1_and category2 items to_the newly created_category.
Perhaps_its too soon to call get_cat_id on the newly created category?
I believe it has_something_to do_with_that,_since the category's reparent on_the 2nd time the theme_is activated._This, I presume, is since the category that_will_be used as_parent has been created previously, the routine has no_problem finding its ID and using_it as the_parent_for_category1 and category2.
What am_I missing?
// with activate make sure_theme's utility categories are present 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');_  _

     _  if(!get_cat_ID('my-utilities')){wp_create_category('my-utilities');}

_     __//find out the_ID_of_the newly_created category, "my-utilities"
__ __   $my_default_cat = my_cat();

__      if(!get_cat_ID('category1')){wp_create_category('category1',$my_default_cat);}
_   __  if(!get_cat_ID('category2')){wp_create_category('category2',$my_default_cat);}

 _    _ //if the categories already existed,_reparent them
_ _     $myCategory1['cat_ID'] = get_cat_id('category1');
   _    $myCategory1['category_parent'] =_$my_default_cat;
   _ __ wp_update_category($myCategory1);

 __ _   $myCategory2['cat_ID'] = get_cat_id('category2');
 _ _    $myCategory2['category_parent'] =_$my_default_cat;
   __   wp_update_category($myCategory2);

  _ }
}

//utility category
function my_cat()
{
  _ if(get_cat_ID('my-utilities')) 
  __{
_    _  return get_cat_ID('my-utilities');
