I have a toolset form to edit an existing custom post type. Works fine, but looking to do more.
The client would like a quicker way to get from one post to the next on edit. Is there a way to do instead of a simple submit and return to the main page, a submit and 'next' function to the next post in the list?
Hi, we have a PHP API that can help you programmatically redirect to some custom URL, but determining which post is the "next" post is the real challenge. Here's an example that redirects to some arbitrary, hard-coded URL:
add_filter('cred_success_redirect', 'custom_redirect',10,3);
function custom_redirect($url, $post_id, $form_data)
{
if ($form_data['id']==12345)
return '<em><u>hidden link</u></em>';
return $url;
}
Replace 12345 with the numeric ID of the Form, and replace hidden link; with the URL you want to redirect to. The problem is determining what that URL should be, programmatically. That would require custom code, and probably falls outside the scope of support we provide here. How is the list determined? Is it a filtered View, or simply all posts ordered by publish date, etc?
Here's the redirection API documentation: https://toolset.com/documentation/programmer-reference/cred-api/#cred_success_redirect