Export/Import custom fields
Instead of using code to embed custom fields from one site to others, we could use another method supported by Meta Box Builder. This extension allows you to export/import custom fields fast and easily.
- This method allows you to choose exporting/importing any field group individually;
- This method allows you to export/import only the field settings, excluding the data that is stored in the fields.
Video Version
Preparation
We need to have the Meta Box plugin and Meta Box Builder on both websites, the original site and targeted one.
You can freely download and activate the Meta Box plugin from wordpress.org.
You can install Meta Box Builder individually or find it in the Meta Box AIO. This extension provides a UI to create custom fields and the export and import features.
After activating two plugins, you’ll see a new Meta Box menu as below:
Creating custom fields
On the original site, let’s create some fields. We have a tutorial on creating custom fields with Meta Box Builder, please take a look for more detail here.
Here we’ll create a field group named Author and export/import its settings to other sites for example.
Exporting field groups and custom fields
To export the custom fields from the original site, go to Meta Box > Custom Fields. Then, a list of field groups will appear. Choose the ones you want to export by ticking the checkbox.
Next, there are two ways to export the field groups.
If you choose one field group, simply click on its Export option like this:
In case you export several field groups, press the Bulk actions dropdown, then select the Export option and Apply.
After that, the file that contains the data of the selected field groups will be downloaded automatically.
Importing field groups and custom fields
In the dashboard of the targeted website you want to import the field group, go to Meta Box > Custom Fields > Import.
Then click on Choose File and select the downloaded file to import the field group.
Then go back to the field groups list in the Custom Fields menu on the targeted site, and you’ll see the imported field group is displayed as follows:
To check whether the field group works well, you might create/edit a page or post where the custom fields are located, the fields will display similar to the original website.