Home Forums Backend Issues (wp-admin) How to use ACF in a plugins admin page Reply To: How to use ACF in a plugins admin page

  • @souvarian and @elliot: thanks for the input.

    It needs some more thorough testing but I think I have it working now. Thanks to you both.

    As I have registered my field_groups using the ACF-UI, I am not using the register_field_group function. That way I don’t have the problem with the location.

    How I use these funtions:
    – on hook ‘admin_init’ I call

    /* hooked on admin_init */
    public function add_afc_head() {
           if (in_array(hbd_functions::get_page_by_url(), hbd_settings::$plugin_page_names)) {
              hbd_debug::write_log('acf_form_head called');

    – on hook ‘admin_menu’ I build by menu using add_menu_page();
    – In the callback of that function I do these actions:
    – Then render my page.
    – In my page I call acf_form like this:

    $options = array(
       'post_id' => hbd_settings::AFC_POST_TOKEN, // post to save to
       'field_groups' => array(hbd_settings::AFC_FORM_ID), // field group id
       'form' => true, 
       'form_attributes' => array(
            'id' => 'design-fotos',
            'action' => '',
            'method' => 'post'
       'return' => add_query_arg( 'updated', 'true', (get_admin_url() . 'admin.php?page=s-advanced-search') ), // return url
       'submit_value' => 'Opslaan', 
       'updated_message' => 'Afbeeldingvelden opgeslagen', 

    I hope this solves your question as well souverian. If it doesn’t open a new thread and let me know. I’ll look into it as well.

    As long as further debugging does not surface any issues; topic solved!

    Thanks for the input,