Is there a method of merging the two, as acf/save_post is allowing me to retrieve the values however it’s sending the email when a post is saved as a draft, so what I really would like to use is publish_post to send the email when the post goes live.
Any pointers on how I can achieve this would be appreciated.
I know this is an old post and I have actually submitted a new post https://support.advancedcustomfields.com/forums/topic/using-publish_posttype-to-get-acf-fields/ in regards to using the publish action with custom post type. I am not able to use $_POST to get the acf values and using acf/save_post only get’s acf fields not wordpress fields like post title and post content. Would it be save to assume that I just need replace all of wp fields like the post title and post content editor with an acf fields?
The post fields that you’re talking about are not fields but data in the post table. When using acf/save_post you need to $post = get_post($post_id) and then access the post information from there like $title = $post->post_title. Or you can skip getting the post and use something like $title = get_the_title($post_id)
Viewing 5 posts - 1 through 5 (of 5 total)
The topic ‘add_action – acf/save_post + publish_post’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users