WPDev.one
Core Function
View Source on Trac ↗

wp_create_categories()

wp_create_categories( mixed $categories, mixed $post_id = '' )

Creates categories for the given post.

Parameters 1 required

Name / Type Description
$categories
string[]

Array of category names to create.

Required
$post_id
int

Optional. The post ID. Default empty.

Return Value

(int[])
Array of IDs of categories assigned to the given post.

Function Information

Since Version
2.0.0
Source File
wp-admin/includes/taxonomy.php
Advertisement