Same issue here with empty image fields.
WP 4.7.1
ACF 5.5.4
I’d certainly consider paying for something like this, if you’d be interested in giving it a go, we should talk more!
Thanks, I appreciate you taking the time to think about it! As much as I’d love to, right now I simply don’t have time to do the digging. I’ll put this idea on hold for now but if anyone decides they want to look into it, let me know!
Nevermind, this seems to work 🙂
I added a default layout in my acf-json-defaults file, then was able to add a new field via the admin.
I did then try to add another field to the JSON, to see if that would then sync with the admin to add the new field, but that didn’t work. Any ideas or is that asking too much?
Also reading the documentation:
“JSON field groups are determined ‘available for sync’ when either the JSON field group does not exist in the DB (field group key is used to match pair), or when the JSON field group contains a higher ‘modified’ value than the DB post’s modified date.”
That seems to be the wrong way round for what I want to do. I want the Database to be a higher modified value than the JSON. Unless I am missing something?
Ok could be moving in the right direction…
So I didn’t mention that this is using a parent / child theme relationship. I want the JSON to live in the parent theme and then for the child theme to read that JSON and add it to the admin.
I’ve tried adding a folder in my parent theme “acf-json-defaults”, and this code to my functions.php.
function my_acf_json_load_point( $paths ) {
// remove original path (optional)
unset($paths[0]);
// append path
$paths[] = get_template_directory_uri() . '/acf-json-defaults';
// return
return $paths;
}
add_filter('acf/settings/load_json', 'my_acf_json_load_point');
But it only seems to work if I put the “acf-json-defaults” folder in the child theme. Even then, when I save the field in admin, it creates a new JSON file with the same key in the “acf-json” folder.
Does that make sense??
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.