Home › Forums › General Issues › differentiate between post types on acf/pre_save_post › Reply To: differentiate between post types on acf/pre_save_post
WOW, I had this exact issue a few weeks ago and could not for the life of me figure it out. I was certain it was my own code that was messing it up. However, since I was not able to get ‘post_type’ to work in the html_after_fields parameter I instead used the $_POST[‘post_id’] value and then did a get_post_type(‘$_POST[‘post_id’]) to determine the type within my various functions.
I think either way works just as well, but my way moves more control to the function rather than relying on the the acf_form array to pass an extra value.
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!
The most recent ACF Chat Friday featured a live demo of how to register CPTs directly in the plugin, one of our most requested features. Check out the summary below for a replay of the demo, and don’t forget to register for the next session! https://t.co/k2KQ3WWBAz— Advanced Custom Fields (@wp_acf) March 9, 2023
© 2023 Advanced Custom Fields.