Redirect after post new entry
-
The hook
frontend_admin/save_post
dont redirect after saving the entry. I got errorundefined
(in red block over form) and nothing happend.
Myfunction.php
add_action('acf_frontend/save_post', 'my_fa_save_post', 10, 2); function my_fa_save_post( $form, $post_id ) { $return_id = $form['record']['post']; // value ok $log_type = get_field('log_type', $post_id); // value ok switch ($log_type) { case 'Planta': $return_id = get_field('log_planta', $post_id); // value ok break; case 'Ambiente': $return_id = get_field('log_ambiente', $post_id); // value ok break; default: $return_id = $post_id; // value ok break; } wp_redirect(get_permalink($return_id)); // value ok exit; }
In the form, a post is chosen to relate to and redirect to when the form is submitted.
log_type
is a conditional forlog_planta
andlog_ambiente
log_planta
orlog_ambiente
return an post ID
Permalink url is ok then
Browser console > network i see the redirection call, but not happened
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Redirect after post new entry’ is closed to new replies.