wp_delete_term

SummerySummery

Removes a term from the database.

Syntax

wp_delete_term( int $term, string $taxonomy, array|string $args = array() )

DescriptionDescription

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.

ParametersParameters

$term

(int) (Required) Term ID.

$taxonomy

(string) (Required) Taxonomy Name.

$args

(array|string) (Optional) Array of arguments to override the default term ID.

  • 'default'
    (int) 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.
  • 'force_default'
    (bool) 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.

Default value: array()

ReturnReturn

(bool|int|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.

SourceSource

File: wp-includes/taxonomy.php


			

ChangelogChangelog

Changelog
Version Description
2.3.0 Introduced.
Scroll to Top