• Resolved kajahal

    (@kajahal)


    Hi, I also want to be able to plan future posts from the frontend form, I see there is an option to set post status (I use select field for that – works fine) – but the problem is, there is no way to add the date (acf date field) when post needs to be published.

    Is there any way to do this?

Viewing 1 replies (of 1 total)
  • Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thanks for the feedback!

    Using the ACFE Form, you can set a future date on a post with the acfe/form/submit/post_args hook (See documentation).

    That hook will let you define the post arguments later passed to the wp_insert_post() function (See documentation). In order to set a scheduled date, you can set a future date (in the Y-m-d H:i:s format), and enable the edit_date parameter. See stackoverflow topic. Usage example:

    add_filter('acfe/form/submit/post_args/form=my-form', 'my_form_post_args', 10, 4);
    function my_form_post_args($args, $type, $form, $action){
        
        // schedule post date
        $args['post_date'] = '2022-05-20 10:00:00';
        $args['edit_date'] = true;
        
        // return
        return $args;
        
    }

    Hope it helps!

    Have a nice day!

    Regards.

Viewing 1 replies (of 1 total)
  • The topic ‘Plan future posts from frontend form?’ is closed to new replies.