rendered paste body $args2 = array (
'hide_empty' => 0,
// 'child_of' => 995,
);
$cats2 = get_categories( $args2 );
echo "<pre>";
print_r( $cats2);
echo"</pre>";
$cat_array = array('category_parent' => $parent, 'cat_name' => 'my new category');
$new_cat_id = wp_insert_category($cat_array,$wp_error );
var_dump($new_cat_id);
var_dump($wp_error);
$args2 = array (
'hide_empty' => 0,
// 'child_of' => 995,
);
$cats2 = get_categories( $args2 );
echo "<pre>";
print_r( $cats2);
echo"</pre>";
-=============================================-
Array
(
[0] => stdClass Object
(
[term_id] => 1
[name] => Uncategorized
[slug] => uncategorized
[term_group] => 0
[term_taxonomy_id] => 1
[taxonomy] => category
[description] =>
[parent] => 0
[count] => 17
[cat_ID] => 1
[category_count] => 17
[category_description] =>
[cat_name] => Uncategorized
[category_nicename] => uncategorized
[category_parent] => 0
)
)
int(1027) NULL
Array
(
[0] => stdClass Object
(
[term_id] => 1
[name] => Uncategorized
[slug] => uncategorized
[term_group] => 0
[term_taxonomy_id] => 1
[taxonomy] => category
[description] =>
[parent] => 0
[count] => 17
[cat_ID] => 1
[category_count] => 17
[category_description] =>
[cat_name] => Uncategorized
[category_nicename] => uncategorized
[category_parent] => 0
)
)