Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1006273
    Alex Kaidan
    Guest

    Hello,

    Was wondering what args are fed into functions bound using add filter avf_form_from

    There is no documentation on this. I would like to set a certain email when using contact forms based upon the subject of the email

    Thank you!

    #1006499

    Hey Alex Kaidan,

    You can use the filter like:

    
    add_filter('avf_form_from', 'avf_form_from_mod', 10, 3);
    function avf_form_from_mod($from, $new_post, $form_params) {
        $from = " (Email address hidden if logged out) ";
        return $from;
    } 
    

    The $new_post variable is an array which contains your form data – you could i.e. use this code:

    
    add_filter('avf_form_from', 'avf_form_from_mod', 10, 3);
    function avf_form_from_mod($from, $new_post, $form_params) {
        print_r($new_post);
        return $from;
    } 
    

    to output the content of $new_post variable and to check which data you need for your if/switch checks. The $form_params array contains the contact form parameters (shortcode parameters).

    Best regards,
    Dude

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.