Function: wp_delete_term

wp_delete_term( integer $term, string $taxonomy, array | string $args )

Removes a term from the database.

Shortcut: wdt

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.

If the term is a parent of other terms, then the children will be updated to that term's parent.

Metadata associated with the term will be deleted.


Name Type(s) Default Value Description
$term integer

Term ID.

$taxonomy string

Taxonomy Name.

$args array | string array()

{ Optional. Array of arguments to override the default term ID. Default empty array.

@type int  $default       The term ID to make the default term. This will only override
                          the terms found if there is only one term found. Any other and
                          the found terms are used.
@type bool $force_default Optional. Whether to force the supplied term as default to be
                          assigned even if the object was not going to be term-less.
                          Default false.



boolean | integer | WP_Error

True on success, false if term does not exist. Zero on attempted deletion of default Category. WP_Error if the taxonomy does not exist.

WordPress Developer Newsletter

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