I was a little preemptive on that one… It looks like using the field_key instead of the field name solved the issue.
Magic. I am using ACF Pro. This is exactly the direction I needed. Thank you so much.
ACF is absolutely amazing.
Everyone would be ideal. (the field is updated on the frontend by customers)
Thanks for the quick reply. Instead of simply hiding it, I’d like to not load it at all. It’s a resource intensive field with hundreds of values stored in it, and it takes a considerable amount of time to load so that’s the reason I was wondering if there was an existing filter that I could use…
Ugh. Sorry folks. Plugin conflict. Post Connector wp plugin was causing the issue. All fixed now.
Hi John,
Deleted the json folder, tried re-saving the field and still no dice.
Also noticed that when trying to save the field, it did create the json file in acf-json, but w/ no field information (just field group info).
John. A priority of -1 on the filter worked perfectly. Thanks for the help man! Cheers and have a great weekend. I’ll keep an eye on the changelog for a fix for this too.
Thanks for the reply. Using that exact function above, I get this:
POST ID: 30673
Hmm, I had tried both new
and new_post
previously to no avail.
Thanks for the reply!
Here is the filter function.
function sl_acf_pre_new_startup( $post_id ) {
if( $post_id != 'new' ) :
write_log('not new');
return $post_id;
else:
write_log($post_id);
return $post_id;
endif;
}
add_filter( 'acf/pre_save_post' , 'sl_acf_pre_new_startup', 10, 2 );
Using the above, it only ever returns “not new” even though it’s creating (successfully) a new post.
Solved it! I just need to check if there were already existing rows, and append data to that array.
if( have_rows('directories', $id) ){
$value = get_field( 'directories', $id );
} else {
$value = array();
}
/*========== Add New Row ==========*/
$value[] = array(
'field_53ed47e4824fd' => $attachment_id,
'field_555caf66e22a3' => $note,
'field_53ed1cd943477' => $date,
'field_53ed1b70f2796' => $list_ID,
);
I had this issue. I ended up clearning _new_ fields from wp_options table and that also worked.
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.