Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




wp_update_category [ WordPress Function ]

wp_update_category ( $catarr )
Parameters:
  • (array) $catarr The 'cat_ID' value is required. All other keys are optional.
Returns:
  • (int|bool) The ID number of the new or updated Category on success. Zero or FALSE on failure.
Defined at:



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.

Source


<?php
function wp_update_category($catarr) {
    
$cat_ID = (int) $catarr['cat_ID'];

    if ( isset(
$catarr['category_parent']) && ($cat_ID == $catarr['category_parent']) )
        return 
false;

    
// First, get all of the original fields
    
$category get_category($cat_IDARRAY_A);

    
// Escape data pulled from DB.
    
$category add_magic_quotes($category);

    
// Merge old and new fields with new fields overwriting old ones.
    
$catarr array_merge($category$catarr);

    return 
wp_insert_category($catarr);
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics