admin管理员组

文章数量:1289832

I have a plugin created with boilerplate from this site: /

And I would like to understand how to automatically add 4 entries in the custom taxonomy category that I have already processed.

I guess this code goes on the activator.php file, but I don't know what code to apply to automatically generate these 4 categories.

Can you guys help me?

UPDATE:

Flipping around a bit more I found this code, but it still doesn't work. Is there perhaps some expedient to consider?

add_action('init', 'add_sexes', 100);

function add_gender()
{
    wp_insert_term(
      'Male', // the term 
      'Gender', // the taxonomy
      array(
        'slug' => 'Male'
      )
    );
}

The goal is to insert 4 custom taxonomy by default when the plugin is activated. Actually nobody knows how to do that?

本文标签: Add default custom taxonomy to plugin activation