Support

Account

Home Forums General Issues Import json with acf-json folder

Solving

Import json with acf-json folder

  • Hello,

    in the docs on this site: https://www.advancedcustomfields.com/resources/local-json/ is descriped how to import fields with json so i created a acf-json folder in my theme-root folder at wp-content/themes/mytheme/acf-json and placed my json file in it but it’s not loaded – did i anything wrong?

    You can see the JSON-File here: http://pastebin.com/qFST8gqe

  • the JSON files in this folder only hold a single field group and this method will only work with field groups that ACF automatically saves in this folder. It does not work with field groups exported with the export tool.

    If you want to import field groups from another site, create an acf-json folder on the other site, save/update the field groups so the are save in the folder and then copy the field groups to the folder on the other site.

    If this is what you’ve already done. You won’t see these field groups in the ACF field group editor, but the will be active on the site. If you want to see the groups in the admin of the new site then you need to use the import tool to import them.

  • @hube2 I’ve tried this, but it doesn’t work.

    I created the fields locally and moved it to the server. Both files (functions.php – local and server) have both functions: one for loading and one for saving. There are no other field groups on the live server.

    The fields are not displayed on post edit and the options page are empty two.

    What is wrong?

    EDIT:
    I’ve do this in the Master-Theme. If i do it in the child theme it works. But only in the folder “acf-json”. Not in my folder /json-sync/.

    I want to use the fields with all themes (4) on all servers. Also i put it in a plugin.

    Saving Works great with this function

    
    add_filter('acf/settings/save_json', 'bks_acf_json_save_point');
    function bks_acf_json_save_point( $path ) {
          // update path
          $path = plugin_dir_path( __DIR__ ) . '/acf-json';
          // return
          return $path;
        }
    

    Loading with this funtion don’t works.

    
    add_filter('acf/settings/load_json', 'bks_acf_json_load_point');
    function bks_acf_json_load_point( $paths ) {
          // append path
          $paths[] = plugin_dir_path( __DIR__ ) . '/acf-json';
          // return
          return $paths;
        }
    
  • I think you should be using

     
    $paths[] = plugin_dir_path( __FILE__ ) . '/acf-json';
    
Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Import json with acf-json folder’ is closed to new replies.