Support

Account

Home Forums Front-end Issues Post from draft to published Reply To: Post from draft to published

  • Hi @hhumphrey

    You sure can.

    Firstly, to edit the draft, you will need to know the ID of the draft / post. You can find this via the user’s ID (all posts are connected to a user) or perhaps via a GET parameter sent back from the acf_form redirect or perhaps via another completely different method.

    I would then create a link to the current page but add a GET param called ?update={$draft_id}. On the page template (which holds the form), you can look for the existence of this GET param. If it exists, modify the acf_form args to use that post_id! This will allow you to edit an existing post / draft.

    To then publish it, you have 2 options:
    1. Add a custom field radio button which you can use a toggle switch (draft / publish). ACF has a hook for the update_value filter which you can use to look at this radio button value and then update the $post based on it (update the post status to publish)

    2. Create a custom button to a custom link (perhaps another GET param) which then your template can use to just update the post status

    Good luck

    Cheers
    E