Support

Account

Home Forums General Issues acf/save_post on specific form Reply To: acf/save_post on specific form

  • Hi @adser

    Your code looks great for me. You can also use “transition_post_status” hook to check if a post is new or updated. You can do it like this:

    function on_post_status_change( $new_status, $old_status, $post ) {
        if ( $new_status != $old_status ) {
            // A function to perform actions any time any post changes status.
            $postedCustomFieldName = $_POST['acf']['field_1234567890'];
    
            //email function here
        }
    }
    add_action(  'transition_post_status',  'on_post_status_change', 10, 3 );

    Where “field_1234567890” is the field key you want to add to the email. To learn more about this hook, please take a look at this page: https://codex.wordpress.org/Post_Status_Transitions.

    I hope this helps.