Home › Forums › Backend Issues (wp-admin) › How to programatically create meta fields for custom page template? › Reply To: How to programatically create meta fields for custom page template?
I was looking for this too. In the end I discovered on the ACF → Export page:
Export to PHP
ACF will create the PHP code to include in your theme.
Registered field groups will not appear in the list of editable field groups. This is useful for including fields in themes.
Please note that if you export and register field groups within the same WP, you will see duplicate fields on your edit screens. To fix this, please move the original field group to the trash or remove the code from your functions.php file.
Select field group(s) from the list and click “Create PHP”
Copy the PHP code generated
Paste into your functions.php file
To activate any Add-ons, edit and use the code in the first few lines.
Hope that helps!
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!
© 2022 Advanced Custom Fields.