[wp-hackers] Best approach

Mike Little wordpress at zed1.com
Wed Sep 28 11:32:14 UTC 2011


On Wed, Sep 28, 2011 at 03:43, Diana K. Cury <dianakac at gmail.com> wrote:

> Thanks for your reply,
>
> I still can't find a way to populate the taxonomies assigning the parent, I
> thinks there´s no way to do so.
>
>
>
Assuming 'mytaxonomy' is defined to be hierarchical:

$parent_term = wp_insert_term( 'My Term Name', 'mytaxonomy', array(
'description' => 'Some description', 'slug' => 'my-term-name' ) );

$term = wp_insert_term( 'My Child Term', 'mytaxonomy', array( 'description'
=> 'Some child description', 'slug' => 'my-child-term', 'parent' =>
$parent_term['term_id'] ) );



Mike
-- 
Mike Little
http://zed1.com/


More information about the wp-hackers mailing list