wpseek.com
WordPress开发者和主题制作者的搜索引擎
wp_update_category › WordPress Function
Since2.0.0
已弃用n/a
› wp_update_category ( $catarr )
| 参数: |
|
| 返回: |
|
| 定义在: |
|
| 文档: |
Aliases wp_insert_category() with minimal args.
If you want to update only some fields of an existing category, call this function with only the new values set inside $catarr.Related Functions: wp_create_category, wp_delete_category, wp_update_core, wp_update_term, update_category_cache
源码
function wp_update_category( $catarr ) {
$cat_id = (int) $catarr['cat_ID'];
if ( isset( $catarr['category_parent'] ) && ( $cat_id === (int) $catarr['category_parent'] ) ) {
return false;
}
// First, get all of the original fields.
$category = get_term( $cat_id, 'category', ARRAY_A );
_make_cat_compat( $category );
// Escape data pulled from DB.
$category = wp_slash( $category );
// Merge old and new fields with new fields overwriting old ones.
$catarr = array_merge( $category, $catarr );
return wp_insert_category( $catarr );
}