Although just in case anyone else should view this, there is a typo on your response, an extra closing bracket within the if statement.
Yeah this is my first outing with cloned fields too. Seems like a great feature, but one that will open up issues for more complicated setups. Mine are nested within flexible content fields and other spots so I’ve held off for now, but am going to try the other loop method you mentioned for now!
Thanks again!
Thanks for everything so far John, I wonder if you had any thoughts on the cloned field aspect? Should loading field values work in this way without issues that you can think of?
As I understand it the field id is the same across the field groups that you clone them to? So would the field loading/population happen across the board?
Ah apologies, just read up and realised I didn’t. It had been a long week!
That sounds like it could be it.
I’ll give that a whirl. Thanks for your time and help.
That’s the thing, it did work, then bombed on memory exhaustion.
I echoed the options and ID to the instructions field and all was correct. wasnt quote sure what might be the issue!
Yeah sorry, I should’ve included anyway! The code is as follows:
function acf_load_anchor_points( $field ) {
$post_id = get_the_ID();
// if has rows
if (have_rows('blocks', $post_id)):
// reset choices
$field['choices'] = array();
// while has rows
while (have_rows('blocks', $post_id)): the_row();
if (get_row_layout() == 'anchor_point'):
$title = get_sub_field('title');
$slug = sanitize_title($title);
$field['choices'][ $slug ] = $title;
endif;
endwhile;
endif;
// return the field
return $field;
}
add_filter('acf/load_field/key=field_57a9b1c80a552', 'acf_load_anchor_points');
Was there ever any progress made with this? I’m developing a site at the moment and want to keep the fields sync’ed using the JSON backup, but don’t want to run in to problems if I use MigrateDB to push over DB changes.
Thanks,
Tom
Likewise, an old thread but this is just started happening for me. Am currently on 5.3.0 and trying to update to 5.3.1.
Cheers,
T
Yeah likewise got this too, throwing an error so can’t update any fields/field groups.
Yeah I’ve noticed this too, along with an issue whereby values aren’t picked up at template level until the post is ‘updated’ which seems to refresh the post values.
This seemed like a great feature to keep ACF fields in GIT and sync’ed between environments, but it’s caused more hassle than it’s worth at the moment!
Yeah this would be a really useful feature. I thought adding a message might do it. Even something as simple as a ‘separator/divide’ field or something.
This site is hosted on 123 Reg (UK).
hey @jsites, yeah this is true! thanks, just not ideal as you say! will wait and see what happens! cheers1
Any one know what’s going on? I can’t seem to get round this, so I have a broken site on my hands…hoping that it doesn’t/hasn’t effected any other sites.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.