Switch language

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




wp_create_categories [ WordPress Function ]

wp_create_categories ( $categories, $post_id = '' )
Parameters:
  • (unknown_type) $categories
  • (unknown_type) $post_id
Returns:
  • (unknown)
Defined at:



{@internal Missing Short Description}}

Source


<?php
function wp_create_categories($categories$post_id '') {
    
$cat_ids = array ();
    foreach (
$categories as $category) {
        if (
$id category_exists($category))
            
$cat_ids[] = $id;
        else
            if (
$id wp_create_category($category))
                
$cat_ids[] = $id;
    }

    if ( 
$post_id )
        
wp_set_post_categories($post_id$cat_ids);

    return 
$cat_ids;
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



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