2
votes

I have a situation in which I am bit confused with WordPress filters and action hooks. I have custom form at front-end (BuddyForms) which is creating wooCommerce product on submit. I have to process some data on such products added from front-end so that I have created a term "custom" under "product_cat" taxonomy and assigned product to this term.

At the time of product creation I want to update some meta data so I tried below actions but none of them provide me the taxonomy details on form submission. It should trigger only once when product is created.

publish_product
save_post
wp_insert_post
wp_insert_post_data

Each above returns the post array and post id, if I try to retrieve the terms assigned to created product using the code below it returns no data. The term is identifier for me to know the product is created from front-end.

$term_list = wp_get_post_terms($post_id, 'product_cat');

I realize the above hooks triggers before or after inserting data into wp_post table but before inserting meta data and categories information.

I need to know which action/hook is helpful for me to get all post information, meta data and category details on new post/product creation.

I hope i didn't mess the question here... :) Thanks in advance!

1

1 Answers

0
votes

You can use save_post as well as wp_insert_post action to get all the information of post