undefined variable in wordpress but it is defined
<p>i created a wordpress theme for myself and in option panel that i get it to work with help of option tree plugin i used a category-select type to choose between.</p>

<p>this is a loop i wrote to choose category in my theme functions file .</p>

<pre><code>$categories = get_categories('hide_empty=0&amp;orderby=name');
$wp_cats = array();
foreach ($categories as $category_list ) {
$wp_cats[$category_list-&gt;cat_ID] = $category_list-&gt;cat_name;
}
array_unshift($wp_cats, "Choose A Category");
</code></pre>

<p>it's work fine on my website , but the problem is on my other website i getting error of Undefined variable</p>

<p>Notice: Undefined variable: wp_cats </p>

<p>this is a category-select array i use to call wp_cats .</p>

<pre><code> array(
'id'          =&gt; 'best_games_category',
'label'       =&gt; ' best games ',
'desc'        =&gt; ' desc ',
'type'        =&gt; 'category-select',
'section'     =&gt; 'category-option',
'choices'     =&gt; array( 
 array(
   'options' =&gt; $wp_cats,
   )
 )
),
</code></pre>

<p>so please tell me what is my mistake and where do i this wrong is there any problem in php version or something related to that , cuz in one site it's work fine as i mentioned but in the other it's not .</p>

<p>thanks in advance</p>