[wp-hackers] creating posts with taxonomy when creating that taxonomy
Lionel POINTET
lionel.pointet at globalis-ms.com
Sun Aug 5 16:04:37 UTC 2012
Hi Kirk,
I think you are talking about wp_insert_term, which fires
"create_{$taxonomy}" and "created_{$taxonomy}" actions.
You get actually the inserted term_id into the first argument. For example:
function my_create_custom_taxo($term_id) {
// I can use the $term_id to get the term object
$term = get_term($term_id, 'custom_taxo');
}
add_action('create_custom_taxo', 'my_create_custom_taxo');
Lionel
2012/8/5 Kirk Wight <kwight at kwight.ca>
> Hello,
>
> I'm using wp_insert_post hooked to create_{$taxonomy} to create a bunch of
> posts when a term is created for a custom taxonomy. I'd like to have those
> inserted posts automatically be given the term that created them, but can't
> figure out from where to get that piece of info, or how to do it.
>
> Is that info in a global maybe ($wpdb?), and could it be used somehow with
> the tax_input key of wp_insert_post?..
>
> Thank you!
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list