functions to create term and child terms

I’ve got a MySQL table with car makes and models. I’m using php to pull the data and enter it into terms in WordPress. What WordPress function would I use to create the term and then the taxonomy ua-auction-category. Then the child term for the model.

Example: Ford -> Fusion. Hope I was clear enough.

Any questions let me know.

1 Answer
1

To create a taxonomy, you should use register_taxonomy(). This function accepts three arguments:

 <?php register_taxonomy( $taxonomy, $object_type, $args ); ?> 

The documents on the codex are plenty self explanatory.

Now, to insert a term into a taxonomy, you can use wp_insert_term(). Again this function accepts 3 arguments:

<?php wp_insert_term( $term, $taxonomy, $args = array() ); ?>

You can check the codex page for instructions.

Leave a Comment