You can use the action hook
add_action('after_qs_cf7_api_send_lead' , 'do_something_with_the_result' , 10 , 2);
function do_something_with_the_result( $result , $record ){
//do whatever you like with the $result
// you also have access here to the original $record
}
Where should I add this hook, i.e. in what file and at what line position?
Will this action hook get erased/overwritten by the next update of the plugin?
Put all code like add_action() or add_filter() in the functions.php in your theme directory. Putting the code into a new plugin will also work.
Note to people using closures:
I tried using this hook by doing something like this
add_action('after_qs_cf7_api_send_lead', function($result, $record) {
// some code
}
For some reason the $record argument isn’t available in the function. But if you do it like QuerySolutions did, it works. I’m not entirely sure why, maybe WordPress does not handle closures correctly.