Here I have custom post type called products
and it's taxonomy is product_categories
. What I need is whenever I add the post in products , I need to call function1, when I update the post then I need to call function2 . How to do this?
I have searched on google and found this solution:
add_action('save_post', 'save_in_filter', 10, 2);
function save_in_filter($post_id, $post){
function1();
}
function mynewproduct(){
myfunction();
}
But what happens is when I click on add new post then suddenly the function1() execute , but what i need is function1 execute after inserting the data not before inserting the data.
When a post is added to products (post_type=products)
i need to
execute function1()
. When a post is updated in products i need to
execute function2();
Why post_updated,save_post function not working properly?