categories - wp_delete_term or wp_delete_category?

Hi I need a simple piece of code to delete a category for a custom plugin, but I just found two function references that

Hi I need a simple piece of code to delete a category for a custom plugin, but I just found two function references that seems quite the same:

Function Reference: wp_delete_term

Description: Removes a term from the database.

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

Function Reference: wp_delete_category

Description: Deletes one existing category.

Usage: <?php wp_delete_category( $cat_ID ) ?>

My question is which one I should use (just for delete a category), and what is exactly the difference (or what makes one option better than the other).

I'm thinking that the "category" is a "term" and that wp_delete_category() uses wp_delete_term() so I should use wp_delete_term() - I'm right on that or I'm missing something.

Thanks

Hi I need a simple piece of code to delete a category for a custom plugin, but I just found two function references that seems quite the same:

Function Reference: wp_delete_term

Description: Removes a term from the database.

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

Function Reference: wp_delete_category

Description: Deletes one existing category.

Usage: <?php wp_delete_category( $cat_ID ) ?>

My question is which one I should use (just for delete a category), and what is exactly the difference (or what makes one option better than the other).

I'm thinking that the "category" is a "term" and that wp_delete_category() uses wp_delete_term() so I should use wp_delete_term() - I'm right on that or I'm missing something.

Thanks

Share Improve this question asked Nov 4, 2012 at 0:00 user983248user983248 1,3603 gold badges20 silver badges31 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

wp_delete_category() is a convenient shortcut if you want to delete a category. Use it to type less.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745102618a4611367.html

相关推荐

  • categories - wp_delete_term or wp_delete_category?

    Hi I need a simple piece of code to delete a category for a custom plugin, but I just found two function references that

    11小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信