Support

Account

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

  • hey @skuijers, this is exactly the question I’ve been trying to answer for a few hours! Have you made any progress?

    Based on what I know at this point, my approach is to

    1. Register my field groups.

    2. Before rendering my settings page call

    do_action('acf/input/admin_head');
     do_action('acf/input/admin_enqueue_scripts');

    3. Add a tag in my settings page template that renders the field.

    The main conceptual block I’ve run into is how I should pass the “location” params in the register_field_group() call so it reference my settings page. The plugin slug I’m using is “es_awp” (i.e. the settings URL is `http://path.to.wordpress/wp-admin/options-general.php?page=es_awp’ so I figured I could do something like this (not sure it works):

        'location' => array (
          array (
            array (
              'param' => 'page',
              'operator' => '==',
              'value' => 'es_awp',
              'order_no' => 0,
              'group_no' => 0,
            ),
          ),
        ),
    

    I’d love to hear your approach and see any code examples if you have. I’ll be sure to post my code if I figure it out too.

    Thanks in advance for any help!