Home Forums General Issues acf_form not saving data when editing on frontend


acf_form not saving data when editing on frontend

  • Hi!

    I’m using an acf_form to have a user create a post, which works no problem. But when the user needs to edit the post info, it shows the acf_form but all the fields are empty, causing the user to have to reinput everything all over again. Is there a way to have the fields populated with the previously inputted info when they edit?

    Here’s my acf_form code:

    Template Name: Preferred Agent Form
    <div class="fl-content-full container">
    	<div class="row">
    		<div class="fl-content col-md-12">
    				'post_id'             => 'new_post',
    				'post_title'          => true,
    				'field_groups'        => array(555),
    				'form'                => true,
    				'html_before_fields'  => '',
    				'html_after_fields'   => '',
    				'submit_value'        => 'Submit Information', 'acf',
    				'updated_message'     => 'Saved!',
    				'honeypot'			=> true,
    // 				'return' => add_query_arg( 'updated', 'true', home_url() ),
    				'new_post'            => array(
    					'post_type'   => 'preferred_agent',
    					'post_status' => 'pending'
    <?php get_footer(); ?>

    Any help on this would be awesome. Thanks!

  • Hello:

    Once the post has been created, to allow the user to edit the data instead of passing “new_post” as the value for post_id you need to pass the id of the post. When the post id is passed, the form will load the existing data for editing.

    Hope this is helpful!

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.