• The hook frontend_admin/save_post dont redirect after saving the entry. I got error undefined (in red block over form) and nothing happend.
    My function.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 for log_planta and log_ambiente
    log_planta or log_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)
  • Thread Starter nicogaldo

    (@nicogaldo)

    temporarily I replace frontend admin shortcode and use acf_form() function for front end and acf/save_post hook with priority less than 10. worked like a charm

Viewing 1 replies (of 1 total)
  • The topic ‘Redirect after post new entry’ is closed to new replies.