Support

Account

Home Forums Front-end Issues Post created from frontend forms are not persisted

Solved

Post created from frontend forms are not persisted

  • Hi,

    I’m trying to use ACF on the frontend for the first time.

    I can successfully display the form but nothing is persisted when I submit the form.

    Am I responsible for actually taking the form information and persisting it?

    This is what I currently have to add the header code and then to display the form:

    function add_acf_code_to_add_event_page() {
        if( is_single( 1450 ) ){
            acf_form_head();
        }
    }
    add_action( 'wp_head', 'add_acf_code_to_add_event_page' );
    
    // Show Event add form
    function add_event_form( ) {
        
        if(is_user_logged_in()){
    
            $options = array(
                'post_id'		=> 'new_post',
                'post_title'	=> true,
                'post_content'	=> false,
                'new_post'		=> array(
                    'post_type'		=> 'client-events',
                    'post_status'	=> 'publish'
                ),
                'submit_value'	=> 'Submit Event',
                'uploader'      => 'basic',
                'honeypot'      => true,
                'updated_message' => __("Thanks for your submission", 'baadier'),
            );
    
            acf_form( $options );
        
        } else {
            return 'Please log in to add a new event';
        }
    
    }

    Thanks!

  • User error..

    The following changes resolved my issues:

    function add_acf_code_to_add_event_page() {
        if( is_page( 1450 ) ){
            acf_form_head();
        }
    }
    add_action( 'get_header', 'add_acf_code_to_add_event_page' );
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Post created from frontend forms are not persisted’ is closed to new replies.