if ( empty( $category['description'
] ) ) { $category['description'
] = '';
} $new_category = array
( 'cat_name' =>
$category['name'
],
'category_nicename' =>
$category['slug'
],
'category_parent' =>
$category['parent_id'
],
'category_description' =>
$category['description'
],
);
$cat_id =
wp_insert_category( $new_category, true
);
if ( is_wp_error( $cat_id ) ) { if ( 'term_exists' ===
$cat_id->
get_error_code() ) { return (int) $cat_id->
get_error_data();
} else { return new IXR_Error( 500,
__( 'Sorry, the category could not be created.'
) );
} } elseif ( !
$cat_id ) { return new IXR_Error( 500,
__( 'Sorry, the category could not be created.'
) );
} /**
* Fires after a new category has been successfully created via XML-RPC.
*
* @since 3.4.0
*
* @param int $cat_id ID of the new category.
* @param array $args An array of new category arguments.
*/