Problem: I would like to import the options for a custom select field
Solution: First create two options manually. Then use Toolset Export to export all your custom fields. Open the zip file and modify the XML file to include the desired custom fields. Each option tag should have a unique name. See the format below.
<field> <id>my-select</id> <slug>my-select</slug> <type>select</type> <name>my-select</name> <description></description> <data> <options> <wpcf-fields-select-option-f0ad8e37f8db21b2b56e09589bc4610b-1> <title>Option title 1</title> <value>1</value> </wpcf-fields-select-option-f0ad8e37f8db21b2b56e09589bc4610b-1> <wpcf-fields-select-option-b3ae68667fc8b5bdf4049bcf0b5cea72-1> <title>Option title 2</title> <value>2</value> </wpcf-fields-select-option-b3ae68667fc8b5bdf4049bcf0b5cea72-1> <wpcf-fields-select-option-my-option-name> <title>My Option Name</title> <value>myoptionvalue</value> </wpcf-fields-select-option-my-option-name> <wpcf-fields-select-option-my-next-option-name> <title>My Next Option Name</title> <value>mynextoptionvalue</value> </wpcf-fields-select-option-my-next-option-name> <default>no-default</default> </options> <submit-key>select-650458854</submit-key> <disabled_by_type>0</disabled_by_type> </data> <meta_key>wpcf-my-select</meta_key> <meta_type>postmeta</meta_type> <wpml_action>2</wpml_action> <__types_id>my-select</__types_id> <__types_title>my-select</__types_title> <hash>c983de0b2103b034786aa5c37b33328f</hash> <checksum>c983de0b2103b034786aa5c37b33328f</checksum> </field>
Verify the XML file is valid using a service like validator.w3.org. Then, zip up the new XML file and the PHP file (no edits are required in the PHP file) into a new archive. Note that the two files should be zipped directly, not added to a directory first. Use Toolset Import to import the archive with your new options in place.
Relevant Documentation: https://toolset.com/documentation/user-guides/how-to-importexport-types-structures/
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
This topic contains 5 replies, has 2 voices.
Last updated by 7 years, 6 months ago.
Assisted by: Christian Cox.