Support

Account

Home Forums ACF PRO Import ACF values

Solving

Import ACF values

  • Hi,

    I’m a ACF Pro user.

    I have a project that requires me to do a large amount of ACF Pro customisation. I have a Post type that has a number of select fields that draw their options from an ACF Options page. The options are setup as repeaters with only 2 fields – “Label” and “Value”.

    What I would like to know is how can I import (csv) or programmatically import these “Label” and “Value”?

    I have found a couple of ACF importers “WP Ultimate CSV Importer” and “Spreadsheet + ACF Import” but they are very limited in what they can do.

    You help will be greatly appreciated!

    Cheers,
    Mark

  • Have you looked at WP All Import Pro? It’s $99 but it supposedly does everything. I’ve not used it because I refuse to pay $99 to import data into ACF for which I paid $25. Seems silly there isn’t a data import feature or add on to ACF that allows bringing in data from another datasource.

  • I have confirmed with WP All Import Pro that importing Options is not an available feature with their plugin.

  • 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.

  • Hey @mark66 Did you find a good solution for this? I have spent a few days on this and can’t find a good solution for importing into the wp_options table.

    It does not look like wp all import has this feature.
    http://www.wpallimport.com/documentation/

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

The topic ‘Import ACF values’ is closed to new replies.