• Resolved benny1495

    (@benny1495)


    Hi I have created a form with custom fields. I have it set to post to a custom post type. how can I set the default status of the post to draft so it does not post to the archive on the front page until approved?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author fabianlindfors

    (@fabianlindfors)

    Hi Benny!

    I’m guessing you’re using Advanced Forms Pro? If so you can use the Pro support channel for quicker responses: https://hookturn.io/contact/

    Setting the default post status is quite easy to do! Try this code:

    
    function create_post_as_draft() {
        // Set post status as draft
        $post_data['post_status'] = 'draft';
    
        return $post_data;
    }
    add_filter( 'af/form/editing/post_data/key=FORM_KEY', 'create_post_as_draft');
    

    Just replace FORM_KEY with form key. Hope this helps 🙂

Viewing 1 replies (of 1 total)

The topic ‘set default status for post created by form.’ is closed to new replies.