• Resolved boneless2

    (@boneless2)


    Hi. So after I send my data to API, it sends me a response. Is there a way to read and save this response? Thanks in advance

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Qube One ltd

    (@querysolutions)

    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
    }
    • This reply was modified 6 years, 7 months ago by Qube One ltd.

    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Get response’ is closed to new replies.