Home Forums Backend Issues (wp-admin) Handle value when updating page and execute function for sending e-mail


Handle value when updating page and execute function for sending e-mail

  • I need to send an email when updating the value of a select created using the ACF on a specific page.

    Ex: Name | Select (0-waiting, 1-approved, 2-validated).

    In my research, I found this alternative:

    When executing the function, I can change the return value, but I need to capture the field name to compose the email message.

    Could you help me with that question?

    function my_acf_update_value( $value, $post_id, $field  ) {
                    /*$msg = "Name = {$name} "; 
                    $headers = array('Content-Type: text/html; charset=UTF-8'); 
                    wp_mail( '[email protected]', 'Title', $msg, $headers );
                    return 2;
        } else { 
            return $value;
    add_filter('acf/update_value/key=field_5bf41f9897b45', 'my_acf_update_value', 117, 4);
  • If I well understand, the “Name” comes from a field filled by the user in the same time he changes the value.

    I don’t know what is your trigger (a classic save button ? an Ajax request ?), but I presume that you can first use the “acf_update_value” filter to register the new Name, after what you can call your current custom function and bring the Name with get_field('name', $post_id). ($post_id is already set as a parameter in your custom function).

  • When using the Get_field it returns me all, I need to get a specific. To facilitate, Please see the image.

    Sample Custom Page

    When you click Refresh, I will take the value of the select and make a condition (if it equals such a thing), sends an email. However, I need to get the specific data, not all of it.

    When updating the contact “Marcus Vinicius ” to “authorize “, I want to send an email to him and need to capture the field email of the loop that it belongs to.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.