Function: wp_create_term

wp_create_term( integer | string $tag_name, string $taxonomy )

Add a new term to the database if it does not already exist.

Shortcut: wct

You can use above key combination to trigger the associated snippet for this function in the WordPress Snippets for Visual Studio Code extension. You can also use this shortcut to search for this function on this website.


Name Type(s) Default Value Description
$tag_name integer | string
$taxonomy string 'post_tag'

Optional. The taxonomy for which to retrieve terms. Default 'post_tag'.


array | WP_Error

WordPress Developer Newsletter

Stay informed of new chapter releases, important WordPress API updates and more.