Support

Account

Home Forums Backend Issues (wp-admin) Including ACF fields in a theme

Solved

Including ACF fields in a theme

  • I have added the php code generated using the ACF export tool into a new theme (functions.php), but when activated, the ACF fields are being stored in the wp_options table rather than the post_meta table.

    This means that I can still write information to the fields, and they are saved, but the fields can’t be edited through the ‘../edit.php?post_type=acf-field-group’ page.

    Any ideas on what I’m doing wrong?

    EDIT —
    just a bit of clarification. I want to add new ACF field groups so that they appear not just on an options page, but also appear as a field group in the custom fields page so that further changes can be made.
    Importing through the ACF plugin tools, using JSON files seems to still do this, but doing it programmatically through a theme or plugin is not.

  • ACF field groups added through PHP cannot be edited in the ACF admin and there isn’t any way to make this happen. You wold need to save a JSON copy and import it when you want to make changes after disabling the group from being added by PHP.

  • Okay thanks for the update.

    Is there any other way of adding field groups to the acf admin without manually importing the JSON through the admin tools? Is there a function that could be triggered to run the import on json files in a specified directory for instance?

  • There seems to be a post here that does it https://stackoverflow.com/questions/41171129/including-acf-advanced-custom-fields-in-a-custom-theme-or-plugin-exporting-fi

    I have not tried it, but would appreciate it if you let me know if it works.

  • That was spot on, thank you.
    Just need to work out how to get ACF table add-on to activate at the same time…

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Including ACF fields in a theme’ is closed to new replies.