When I edit a post on my frontend using a cred form, the url of that page ends up being something like:
hidden link
When I click the save button to save the post, it takes me back to the item to view it normally, but the whole page url structure of that post is different. It turns into something like hidden link
Is there a function I can use so that it redirects back to the same post, using the url it was at? So when I save the post, it goes back to hidden link
This is very important to get working so that the whole system works properly.
Can you please try this hook to redirect the user to your desired page.
As well as, What if you try to change the form settings "After visitors submit this form:" and set it to "Keep Displaying this form" if that works you do not need to use the hook "cred_success_redirect".
Yes that worked. I have an issue though. I also had this in my functions.php:
add_filter('cred_success_redirect', 'custom_redirect',10,3);
function custom_redirect($url, $post_id, $form_data) {
// if a specific form
if ($form_data["id"]==1625 && isset( $_POST['continue'] ) )
return '/';
return $url;
}
and when I add your code, it obviously breaks the site since both function names are the same. When I change the function names, the site comes back up, but then the code you just sent stops working. Basically this code I'm enclosing in this post already existed in my functions file allowed me to make a 'save & continue' button that stays on the page after you save. I'd like to keep that too.