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.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.