Home Forums Front-end Issues Edit Post Form sets comment_status OFF Reply To: Edit Post Form sets comment_status OFF

  • Hi @adeon

    I believe you’re using ACF free version. That means that you need to use extra functions to save the post. This page should give you more idea about it:

    I’m not really sure why it changes the comment status, bu you can always use the acf/save_post hook to change it back like this:

    function my_acf_save_post( $post_id ) {
        // Only do it for the front end form
        if( is_admin() ){
        // set the comment status
        $my_post = array(
            'ID' => $post_id,
            'comment_status' => 'open',
        // remove action to avoid infinite loop issue
        remove_action('acf/save_post', 'my_acf_save_post', 20);
        // update the post
        wp_update_post( $my_post );
        // add the action back
        add_action('acf/save_post', 'my_acf_save_post', 20);
    // run after ACF saves the $_POST['acf'] data
    add_action('acf/save_post', 'my_acf_save_post', 20);

    I hope this helps 🙂