Sorry for asking the already asked question . I get confused in many ways that’s why i am asking .

Here i have custom post type called products and it’s taxonmy is product_categories . What i need is when ever 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 search on google and i found this solution

add_action('save_post', 'save_in_filter', 10, 2);
        function save_in_filter($post_id, $post){
          function1();  
        }


 function mynewproduct(){
    myfunction();
}

but here what happen 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 .

please help .

Read more here: call a function when insert and update a custom post type


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: