Support

Account

Home Forums Backend Issues (wp-admin) acf_form values not displaying in admin, are displaying on front end

Helping

acf_form values not displaying in admin, are displaying on front end

  • Hello,

    I am trying to create a front end form using acf_form where the user creates a new post with a custom post type. Right now the form is functioning properly (for the most part).

    <?php
    				$fields = array(
              'field_5d013b346baea',
              'field_5d013b896baeb',
              'field_5d013a8b6bae9',
              // 'field_5d013bc76baec', Date picker not working
              // 'field_5d013c0e6baed', Date picker not working
              'field_5d013c206baee',
              'field_5d013c686baef',
              'field_5d013d286baf0',
              'field_5d013e076baf1',
              'field_5d0cfa77af818',
              'field_5d10e36917116',
              'field_5d0d004bdd56b'
    				);
    				acf_register_form(array(
    					'id'       => 'new-microsite',
    					'post_id'  => 'new_post',
    					'new_post' => array(
    						'post_type'   => 'microsite',
    						'post_status' => 'draft',
    					),
    					'post_title'   => true,
    					'post_content' => true,
    					'uploader'     => 'basic',
    					'return'       => home_url('/'),
    					'fields'       => $fields,
    					'submit_value' => 'Submit your Microsite'
    		    	));
    
    				acf_form('new-microsite');
    			?>

    When I call the content <?php the_field('show_name') ?> it displays correctly on the front end. However, the admin doesn’t show any of the submitted values on the post edit screen. Essentially all the custom fields show up as blank, but the front end preview does get the correct data and display it properly.

    Any idea as to why the fields show no values?

    I have acf_form_head(); placed correctly.

    It may be worth noting that the date picker and a WYSIWYG editor are not working properly on the front end, but I think that is a separate issue.

    Thanks for your help!

  • Okay, realized there were lots of console errors that were most likely related to this (it’s what was causing the date picker issue among others)

    Noticed that if I switched the order of

    <?php acf_form_head(); ?>
    <?php get_header(); ?>

    to

    <?php get_header(); ?>
    <?php acf_form_head(); ?>

    based on this

    This caused an issue on submit as mentioned.

    So, I added

    <?php 
      ob_start();
      get_header();
      acf_form_head();  // <--- here!
      echo ob_get_clean();
    ?>

    Now the info appears in the admin correctly after submit…but doesn’t display correctly on the front end.

    To be continued.

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

The topic ‘acf_form values not displaying in admin, are displaying on front end’ is closed to new replies.