Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

My client has a post type that uses a lot taxonomies. I plan to put this script in a post meta box and hide the existing taxonomies.

Do you know of a great wp_set_post_terms example?

I want to make this:
enter image description here

Look like this: enter image description here

Related functions? wp_update_term

share|improve this question
    
I think you're looking for wp_set_post_terms() –  onetrickpony Jul 24 '11 at 13:53
    
I think you might be right, question edited. –  mattrepublic Jul 24 '11 at 15:15
    
I am not sure what example you are looking for. Function itself is documented (more or less) in Codex. Do you want full metabox example with it or what? –  Rarst Jul 24 '11 at 15:22
    
I can make a meta box, my question really is what, if anything, do I need to wrap/include with wp_set_post_terms()? –  mattrepublic Jul 24 '11 at 15:36

1 Answer 1

up vote 1 down vote accepted

Name your fields like car_specs[taxonomy_name], then within "save_post" just do:

foreach($_POST['car_specs'] as $tax => $term)
  if(taxonomy_exists($tax)) // && term_exists($term, $tax)
    wp_set_post_terms($post_id, $term, $tax);

Personally I wouldn't use WordPress for a auto classifieds type of website. There are PHP frameworks out there better suited for building such sites

share|improve this answer
    
Thanks for the starting point. This project is for an independent study program at my university. –  mattrepublic Jul 24 '11 at 23:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.