0

I need to send a code to a third person through Github with custom posts and custom fields for them just add the posts.

I have tried to find this approach online but I could not find the answer since all of them just talk about version control between local and production WP.

I am using MAMP, ACF and Custom Post Type UI to develop the site, linking the custom fields to custom post.

1 Answer 1

1

ACF has two options for this:

  1. PHP / JSON exports
  2. acf-json

Method 1)

Go to ACF->tools->select field->export file / generate PHP.

If you choose generate PHP, you can copy the result into a .php file in your theme, which you then need to include. You cannot import PHP exports though ACF again: the fields will be available but you will not be able to edit them through the ACF UI.

If you choose JSON, you can import them again and edit them through ACF.

Method 2)

I prefer this method: create a folder called acf-json in your main theme folder. ACF will detect the folder and automatically save a copy of the fields as JSON files.

Whichever method you choose, make sure to add/commit any files created/changed to your repo.

Never used the Custom Post Type UI plugin, but I imagine it has a similar import/export capability.

Alternatively, you can also share an export of your DB, but there will be no version control for fields/etc.

2
  • Perfect, I followed exactly as ou told me as second option and yes it alto generates the json file. I have a small doubt, If I delete the app or add the folder in a different MAMP will it persist? BTW, I really appreciate your answer. Thank you. Commented Dec 12, 2020 at 19:18
  • If you copy the acf-json folder to another site (with ACF installed/active) you'll be able to use the same fields. Although, you'll have to go to ACF->field groups and use the "Sync" option to be able to edit them in ACF again. Deleting the plugin will disable the fields, but not delete the folder.
    – tdj
    Commented Dec 13, 2020 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.