Home › Forums › Front-end Issues › Multiple CPT front-end post issue › Reply To: Multiple CPT front-end post issue
Hi @florushj
The issue here is that bother forms (created with the acf_form function) will trigger the same ‘acf/pre_save_post’ filter.
To allow for multiple pre_save_post filters and multiple forms, you need to find a way to connect the form to the correct filter! This can be done by customizing the ‘post_id’ param in the form.
Current you are using ‘new’ for the post_id, correct? If you canged that to ‘new_cpt_a’ on one form, and ‘new_cpt_b’ on another form, then you can run the correct filter like so:
// within filter 1
// check if this is to be a new post
if( $post_id != 'new_cpt_a' )
{
return $post_id;
}
// within filter 2
// check if this is to be a new post
if( $post_id != 'new_cpt_b' )
{
return $post_id;
}
Hope that helps
Thanks
E
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.