I’m having some trouble tracking down a method of doing something that I’m sure must be pretty easy. I have a custom post type with a custom field that stores a date (format: yyyy-mm-dd-t). When the post is published, I would like WordPress to use the contents of that field to automatically populate a hierarchical taxonomy of years and months.
From what I’ve found, all I need to do is hook a function onto save_post in functions.php that uses wp_set_object_terms to populate the taxonomy. This is great for one-level taxonomies, but I’ve not found anything to explain how to populate the second level, ie. assigning the month taxonomy underneath the year.
Can anybody explain this process to me? Thanks!
- The topic ‘Automatically populating a custom taxonomy from a custom field’ is closed to new replies.