Wordpress: executing a function when saving or editing a message

This is what I am trying to accomplish: If I add or edit a message, I want to run a function that puts post_id, all user-defined field values ​​and category IDs in some other db table that I created. I just want to know how to execute this function and how to get the values.

+3
source share
1 answer

Add functions.phpyour theme to your file. It will work with both saving and updating. Since you have a message id, you can do whatever you want.

function do_my_stuff($post_ID)  {
   //do my stuff here;
   return $post_ID;
}

add_action('save_post', 'do_my_stuff');
+4
source

All Articles