• Resolved simoptim

    (@simoptim)


    hello,
    on my website i have a custom post type, where i collect all my custom fields of acf pro, for basic options (acf option site).

    There is also an email adress field.

    Is it possible to automatically use this email adress (from the acf field) for my form? So that the form will automatically sent to this email adress setted in the acf field.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author fabianlindfors

    (@fabianlindfors)

    Absolutely! You can change the recipient of an email using the af/form/email/recipient filter (documented here: https://advancedforms.github.io/filters/af-form-email-recipient/).

    Here’s how you can fetch the recipient from an ACF options field:

    
    function change_email_recipient() {
      // Fetch email from options field
      $email = get_field( 'email_field_name', 'options' );
      return $email;
    }
    add_filter( 'af/form/email/recipient/key=FORM_KEY', 'change_email_recipient', 10, 0 );
    

    Replace FORM_KEY with your actual form key. Hope this helps! ??

    Thread Starter simoptim

    (@simoptim)

    awesome works great!
    thanks for the lightspeed support ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Using the email adress of an acf field’ is closed to new replies.