Title: Update post?
Last modified: June 30, 2020

---

# Update post?

 *  Resolved [Messaone](https://wordpress.org/support/users/messaone/)
 * (@messaone)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/update-post-6/)
 * Is there any tutorial how to set up form that a post get updated?
    Do i need 
   to set form to the post? Or can i also use url parameter to update post?
 * Best Regards

Viewing 1 replies (of 1 total)

 *  Plugin Author [Konrad Chmielewski](https://wordpress.org/support/users/hwk-fr/)
 * (@hwk-fr)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/update-post-6/#post-13066332)
 * Hello,
 * Thanks for the feedback.
 * [@messaone](https://wordpress.org/support/users/messaone/):
 * There’s different way to update a post using ACF Extended: Forms.
 * – You can display the form using `acfe_form('my-form')` or `[acfe_form name="
   my-form"]` on the actual post you want to update. You’ll have to add an “Post
   Action” in the form, and set the Action as “Update Post”.
 * In the “Save” tab you can leave the Target on “Current: Post”. In the “Load” 
   tab you can also leave the source as “Current: Post”.
 * Remember to map the fields you want to Save & Load the data from. Also note that
   you have to check the ACF fields checkboxes you want to save & load aswell. See
   screenshots: [https://imgur.com/a/b4qNyMg](https://imgur.com/a/b4qNyMg)
 * – You can display the form on a different page (which isn’t related to the post
   you want to update). Let’s say you created a page `/post-update/` and display
   the form there. You have to decide how you want to pass the actual Post ID you
   want to update.
 * You can pass the targeted Post ID in the URL, like that: `/post-update/?my-post
   =123`. If you do that, then you should use the template tag `{request:my-post}`
   in the “Save Target” & “Load Source” settings (just type it inside). See screenshot:
   [https://i.imgur.com/6PxfBFb.png](https://i.imgur.com/6PxfBFb.png)
 * The `{request:my-post}` retrieve the `$_REQUEST` PHP variable, which get both`
   $_POST` & `$_GET`. In your case, it will retrieve `$_GET['my-post']` from the
   URL.
 * An another way to pass the targeted Post ID, without having it in the URL is 
   to use `set_query_var()` function. Let’s say the current logged user can only
   update one post, let’s say the post `143`, you add the following code in your`/
   post-update/` PHP template:
 *     ```
       // Add your own logic here to find the good post id
       $allowed_post_id = 143;
   
       // Set Query Var
       set_query_var('post-update-id', $allowed_post_id);
   
       // Display Form
       acfe_form('my-form');
       ```
   
 * Then in your form, use the `{query_var:post-update-id}` template tag in the `
   Save Target` & `Load Source` settings. See screenshot: [https://i.imgur.com/obUy0RG.png](https://i.imgur.com/obUy0RG.png)
 * The template tag `{query_var:post-update-id}` will call the PHP function `get_query_var('
   post-update-id')`, to retrieve data set before (in the page like in this example).
 * [@ianchapman](https://wordpress.org/support/users/ianchapman/): You should read
   my answer above, it will help you to find the best way to pass data in your multi-
   step configuration. If you don’t want to pass the post ID in the URL, then you
   should go for the `query_var` method.
 * Note: If you want to pass a `query_var` from the Step 1 form to the Step 2 form(
   let’s say you generate a query var from an action), then you have to leave the“
   Redirection” setting empty. In fact, redirections will clear all headers, which
   include any `$_POST` or `query_var` data.
 * If the redirection is necessary, then you’ll have to create your own logic with
   the currently logged user & check which fields has been already saved in the 
   DB to determine which form to display for example.
 * If it’s alright to leave the redirection empty, then you’ll have access to all
   the necessary data to display the Step 2 Form. Let’s say you have a page `/multi-
   forms/`, you can do something like that in the PHP template:
 *     ```
       // Forms names
       $form_step_1_name = 'form_step_1';
       $form_step_2_name = 'form_step_2';
       $form_step_3_name = 'form_step_3';
   
       // Check if form has been submitted
       if(acf_maybe_get_POST('_acf_form')){
   
           // Get submitted form data
           $form = json_decode(acf_decrypt($_POST['_acf_form']), true);
   
           // If Form Step 1 has been submitted
           if(acf_maybe_get($form, 'form_name') === $form_step_1_name){
   
               // Display Form Step 2
               acfe_form($form_step_2_name);
   
           }
   
           // Elseif Form Step 2 has been submitted
           elseif(acf_maybe_get($form, 'form_name') === $form_step_2_name){
   
               // Display Form Step 3
               acfe_form($form_step_3_name);
   
           }
   
           // Elseif Form Step 3 has been submitted
           elseif(acf_maybe_get($form, 'form_name') === $form_step_3_name){
   
               // Success!
               echo 'Success!';
   
           }
   
       // No Form submitted
       }else{
   
           // Display Form Step 1
           acfe_form($form_step_1_name);
   
       }
       ```
   
 * Hope it helps!
 * Have a nice day.
 * Regards.

Viewing 1 replies (of 1 total)

The topic ‘Update post?’ is closed to new replies.

 * ![](https://ps.w.org/acf-extended/assets/icon-256x256.png?rev=2071550)
 * [Advanced Custom Fields: Extended](https://wordpress.org/plugins/acf-extended/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/acf-extended/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/acf-extended/)
 * [Active Topics](https://wordpress.org/support/plugin/acf-extended/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/acf-extended/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/acf-extended/reviews/)

 * 1 reply
 * 4 participants
 * Last reply from: [Konrad Chmielewski](https://wordpress.org/support/users/hwk-fr/)
 * Last activity: [5 years, 11 months ago](https://wordpress.org/support/topic/update-post-6/#post-13066332)
 * Status: resolved