wp_delete_category

函数
wp_delete_category ( $cat_ID )
参数
  • (int) $cat_ID Category term ID.
    Required:
返回值
  • (bool|int|WP_Error) Returns true if completes delete action; false if term doesn't exist; Zero on attempted deletion of default Category; WP_Error object is also a possibility.
定义位置
相关方法
wp_update_categorywp_create_categorywp_delete_termwp_insert_categorywp_delete_site
引入
2.0.0
弃用
-

wp_delete_category:此函数从WordPress数据库中删除类别。它将类别ID作为参数,并从数据库中删除类别的元数据和术语。

删除一个现有的类别

function wp_delete_category( $cat_ID ) {
	return wp_delete_term( $cat_ID, 'category' );
}

常见问题

FAQs
查看更多 >