Home › Forums › Front-end Issues › To create a link to edit a front form? › Reply To: To create a link to edit a front form?
I am using this way!
Edit post url:
http://website.com/editformpage/?post_id=<?php echo get_the_ID();?>
//form.php template
<?php if ( is_user_logged_in() ) { ?>
<?php acf_form(array(
'field_groups' => array(xx),
'post_id' => 'myid',
'submit_value' => 'Submit',
'return' => '%post_url%',
'updated_message' => ''
)); ?>
<?php } else { ?>
Login Form
<?php } ?>
//editform.php template
<?php if ( is_user_logged_in() ) { ?>
<?php
$post_id = $_GET['post_id']; // get post_id option
$options = array(
'post_id'=> $post_id,
);
acf_form($options);
?>
<?php if ( is_user_logged_in() ) : ?>
<?php /* The loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php acf_form(array(
'field_groups' => array(xx),
'post_id' => $post_id,
'post_title' => false,
'return' => '%post_url%',
'submit_value' => 'Update'
)); ?>
<?php endwhile; ?>
<?php endif; ?>
<?php } else { ?>
Login Form
<?php } ?>
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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.