WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/wp delete term

Description

Removes a term from the database.

Usage

<?php wp_delete_term$term_id$taxonomy$args )  ?>

Parameters

$term_id
(int) (required) The ID of the term.
Default: None
$taxonomy
(string) (required) The context in which to relate the term to the object.
Default: None
$args
(array) (optional) Overwrite term field values.
Default: None

Return Values

bool | WP_Error 
Returns false if not term; true if completes delete action.

Example

<?php wp_delete_term25'category' )  ?> Deletes the term with the ID 25 from the taxonomy "category" using the default function arguments

Notes

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

The $args 'default' will only override the terms found, if there is only one term found. Any other and the found terms are used.

The $args 'force_default' will force the term supplied as default to be assigned even if the object was not going to be termless.

Change Log

Since: 2.3.0

Source File

wp_delete_term() is located in wp-includes/taxonomy.php.

Related

wp_insert_term wp_update_term

See also index of Function Reference and index of Template Tags.