• This feature seems to be incredibly helpful but in practice I cannot make it do anything useful. The documentation is incredibly detailed and well organized but the thing I am looking for and continue to thing MUST be there is not there. I must be missing something.

    I want to take an ACF field group that I created for a custom post type and output the form with that field group somewhere in admin not on that cpt edit page. It seems like using a filter to change the post_id I am trying to edit should do this: something like:

    add_filter('acfe/form/load/form=testing-1', 'my_form_load', 10, 2);
    function my_form_load($form, $post_id){
    
    	// change the affected post id
    	$form['post_id'] = 3337;
        return $form;   
    }

    should change the post affected, but doing this along with Dynamic form post actions does not do anything.

    Please tell me what I am missing in all this well worded and very organized documentation

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

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

    (@hwk-fr)

    Hello,

    Thanks for the feedback!

    The ACFE Form module is designed to display & process forms on the front-end. I would not recommend to use it in the back-end, as it will require some tweaks and advanced customizations which are kinda out of the bounds of the module.

    Additionally, the $form['post_id'] is an internal key setting that shouldn’t be changed, unless in some very specific use case. To “change the affected post id”, you’ll have to use a Post Action in your form, which then allow you to set the saved/loaded post id either in the Form UI, or within a hook as explained in the documentation.

    Please note that for your use case, if you want to save/update a specific post id with a Field Group from an Admin Page, I would reommend to simply use an ACF Options Page (See documentation), and display your Field Group on it. In your Options Page settings, you can set a specific argument post_id => 3337 which will tell to ACF to load/save values on that post.

    Usage example:

    add_action('acf/init', 'my_acf_options_page');
    function my_acf_options_page(){
        
        acf_add_options_page(array(
            'page_title' => 'My Options Page',
            'menu_title' => 'My Options Page',
            'menu_slug'  => 'my-options-page',
            'post_id'    => 3337, // load/save values on the post id: 3337
        ));
    
    }

    For further assistance regarding ACF Options Page, I would recommend to check their documentation, as it is a native ACF feature.

    Hope it helps!

    Have a nice day!

    Regards.

Viewing 1 replies (of 1 total)
  • The topic ‘Any simple guides on making forms do anything’ is closed to new replies.