wp_delete_term

Sponsored Link

データベースからタームを削除します。

Sponsored Link

Removes a term from the database.

wp_delete_termのファンクションタグ使用方法

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

wp_delete_termのパラメーター

$term_id

(int) (required) タームのIDです。
デフォルト:なし

(int) (required) The ID of the term.
Default: None

$taxonomy

(string) (required) オブジェクトにタームを関連するためのコンテキスト。
デフォルト:なし

(string) (required) The context in which to relate the term to the object.
Default: None

$args

(array) (optional)タームフィールドの値を上書きします。
デフォルト:なし

(array) (optional) Overwrite term field values.
Default: None

返り値

bool | WP_Error

タームがない場合はfalseを返します;trueの場合、完了はアクションを削除します。

Returns false if not term; true if completes delete action.

<?php wp_delete_term( 25, 'category' )  ?>

デフォルトの関数の引数を使用しているタクソノミー”category”からID25のタームを削除します。

Deletes the term with the ID 25 from the taxonomy “category” using the default function arguments

注意

タームが他のタームの親である場合、その子はタームの親に更新されます。

1つのタームを見つけた場合、$argsのデフォルトだけが見つけたタームをオーバーライドします。任意の他と発見したタームが使用されます。

$argsの’force_default’はオブジェクトが無限がないことを行なっていない場合でも供給されたデフォルト値が割り当てられるとタームを強制されます。

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.

変更ログ

Since: 2.3.0

ソースファイル

wp_delete_term()は、taxonomy.php内に位置しています。

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

関連ファンクションタグ

wp_insert_term wp_update_term

Sponsored Link