Home › Forums › ACF PRO › Import ACF values › Reply To: Import ACF values
There isn’t any tool that I am aware of that will let you export and import values from/to the wp_options table. Anything like this you’d probably be looking at building yourself.
Keep in mind that for every option name you have that there is another value in the table that matches it with the field_key value associated with the field. Option names created by ACF are "options_{$your_field_name}"
and the matching field key is stored under "_options_{$your_field_name}"
. Repeaters or anything with sub fields gets a lot more complicated.’
When dealing with options, or any value that may or may not be present, for example if these options are part of a theme and the option values are needed when the theme is installed, the best choice, and best coding practice, is to have a default value for all fields, use the default value in your code and assume that the value may not exist. For example
$value = get_field('my_option_field', 'options');
if (!$value) {
$value = 'my default value'
}
This can also be written something like this
if (($value = get_field('my_option_field')) === NULL) {
$value = 'my default value';
}
Yes, this is a little more work but much less work than building and export/import tool for these values.
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.