Support

Account

Home Forums ACF PRO Frontend Posting works but frontend post editing does not

Solved

Frontend Posting works but frontend post editing does not

  • I have frontend posting working, but when I go to edit the frontend post (on the frontend) I make the edit and save but nothing saves.

    Here is what I have for the frontend posting section on the Template Page:
    <?php
    acf_form(array(
    ‘post_id’ => ‘new_post’,
    ‘field_groups’ => array(57),
    ‘post_title’ => true,
    ‘meta_input’ => $_POST[‘acf’][‘field_5a74c753efdce’],
    ‘post_content’ => false,
    ‘form’ => true,
    ‘new_post’ => array(
    ‘post_type’ => ‘announcements’,
    ‘post_status’ => ‘publish’
    ),
    ‘return’ => ‘%post_url%’,
    ‘submit_value’ => ‘Add Post’,
    ));
    echo ‘</div>’;
    ?>
    <!—— If user is not admin ——>
    <?php
    } else {
    echo ‘<h2>Sorry, you must be an administrator to access this page.</h2>’;
    }
    ?>

    Here is what I have for the single page for editing:
    <h2><?php the_title(); ?></h2>

    <!– Gallery Images for post –>
    <?php if( get_field(‘announcement_gallery’) ) { ?>
    <?php
    $gal_images = get_field(‘announcement_gallery’);
    if( $gal_images ): ?>

    <?php endif; ?>
    <?php } ?>
    <!– End Gallery Images for post –>

    <p><?php the_field(‘announcement_content’); ?></p>

    <!– Script/Code for toggle editor –>
    <?php $current_user = wp_get_current_user(); if ( $current_user->ID == $post->post_author ) { ?>
    <script>
    $( document ).ready(function() {
    $( “#editor-btn-wrap #edit-btn” ).click(function() {
    $( “#editor-btn-wrap form” ).css( “display”, “block” );
    $( “#cancel-btn” ).css( “display”, “inline-block” );
    });
    $( “#editor-btn-wrap #cancel-btn” ).click(function() {
    $( “#editor-btn-wrap form” ).css( “display”, “none” );
    $(this).css(“display”, “none”);
    });
    });
    </script>

    <div id=”editor-btn-wrap”>
    <span id=”edit-btn”><i class=”fa fa-pencil-square-o”></i> Edit Post</span><span id=”cancel-btn”><i class=”fa fa-times”></i> Cancel</span>
    <?php acf_form(); ?>
    </div>

    <?php } ?>

    Not sure what I need to do to get the single page to edit and save to the post. Any help would be great.

  • I don’t see the ID of the post you’re trying to edit to be passed into the form, but your code is not that easy to read 🙂 If you can still edit the post, please wrap it in back ticks (see the code button in the editor).

    Have you added acf_form_head() to your edit page as well ?

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

The topic ‘Frontend Posting works but frontend post editing does not’ is closed to new replies.