Home › Forums › Backend Issues (wp-admin) › acf_form values not displaying in admin, are displaying on front end
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?
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(); ?>
<?php get_header(); ?> <?php acf_form_head(); ?>
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.
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
Are you building WordPress sites with ACF and @BeaverBuilder, and wanted to use your ACF Blocks in both the block editor and Beaver Builder?— Advanced Custom Fields (@wp_acf) May 10, 2023
The BB team recently added support for using ACF Blocks in Beaver Builder. Check it out 👇https://t.co/UalEIa5aQi
© 2023 Advanced Custom Fields.