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!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
The new features in ACF 6.1 mean we’ve nearly doubled the number of translatable strings, and we need help translating them into your language. See how translations are progressing and how you can help at the link below. https://t.co/TkEc2Exd6U
— Advanced Custom Fields (@wp_acf) May 17, 2023
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.