Was trying to use this today:
WP Create Category https://codex.wordpress.org/Function_Reference/wp_create_category
Trying that (which I also assume it's only going to add terms to the built in "Categories" taxonomy) throws this error:
Fatal error: Call to undefined function wp_create_category() in /yourwebsite/wp-content/themes/fitt/functions.php on line 123
Though I do see it in /wp-admin/includes/taxonomy.php on line 45:
/**
* Add a new category to the database if it does not already exist.
*
* @since 2.0.0
*
* @param int|string $cat_name
* @param int $parent
* @return int|WP_Error
*/
function wp_create_category( $cat_name, $parent = 0 ) {
if ( $id = category_exists($cat_name, $parent) )
return $id;
return wp_insert_category( array('cat_name' => $cat_name, 'category_parent' => $parent) );
}
Has anyone ever seen this before? A function coming up as undefined though it appears to be from both the code and Codex documentation?