Hi there,
I am in the middle of working on a solution for a customer – and I have had a few issues along the way with the ACF front end form.
I have been trying various things, but now it seems as if the return value (for the redirect) is *stuck*. I have changed it to another value but it still directs to the old value.
Is the return value saved somewhere?
There is no cache plugin, and I have cleared my local cache, flushed DNS etc.
Also, the form fields were saved to a new post – worked flawlessly. This no longer works since I updated to the latest version of ACF Pro.
It doesn’t seem like the redirect value is cached. Looking at the code you can see that it simply uses wp_redirect()
with a default status of 302:
/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-front.php
acf_form_front::submit_form() LN 451
// redirect
if( $return ) {
// update %placeholders%
$return = str_replace('%post_id%', $post_id, $return);
$return = str_replace('%post_url%', get_permalink($post_id), $return);
// redirect
wp_redirect( $return );
exit;
}
Whatever is caching the redirect it doesn’t seem like it would be Advanced Custom Fields. Could it be another plugin or theme function interfering?
Thanks for the reply!
I’ve actually got it sorted – it was my mistake all along.
I had a line break before the acf_form_header() (so the redirect didn’t work – but it saved etc. as usual).
Then in order to fix the redirect issue, I set up my own redirect (which needed an exit below it!) by hooking up acf/sav_post which then obviously would redirect but exit before actually saving. I obviously then forgot that I added this bit of code!
tldr: Silly mistake by me!