Support

Account

Home Forums Bug Reports Frontend Form Issues: pre_save_post & save_post Reply To: Frontend Form Issues: pre_save_post & save_post

  • It is pretty weird huh? I’m absolutely weirded out by this one…

    Okay, the save_post action is commented out and the following debugging statements were added to acf_form_head (results below);

    function acf_form_head()
    {
        // global vars
        global $post_id;
    
        // verify nonce
        if( isset($_POST['acf_nonce']) && wp_verify_nonce($_POST['acf_nonce'], 'input') )
        {
            var_dump($post_id); // OUTPUT: NULL
    
            // $post_id to save against
            $post_id = $_POST['post_id'];
    
            var_dump($post_id); // OUTPUT: string(3) "new"
    
            // allow for custom save
            $post_id = apply_filters('acf/pre_save_post', $post_id);
    
            var_dump($post_id); // OUTPUT: NULL
    
            die();
    
            // save the data
            do_action('acf/save_post', $post_id);
    
            // ...
        }
    
        // ...
    }