One issue is that once the user exits the images do not show up in the gallery area which may cause confusion.
I was thinking I could force a save and page refresh…but not sure how to trigger that event.
I may have solved this with the below if anyone else ever runs into this issue. It is limited to affecting uploads only to a certain post type. Not sure if you could limit to only uploads via the gallery field somehow…
function add_filter_upload_image($attach_id){
$post_id = wp_get_post_parent_id( $attach_id );
$post = get_post($post_id);
if($post->post_type == <custom-post-type>){
$array = get_field(‘field_5f0dcbfc35af4’, $post_id, false);
if (!is_array($array)) {
$array = array();
}
$array[] = $attach_id;
update_field(‘field_5f0dcbfc35af4’, $array, $post_id );
}
}
add_filter(‘add_attachment’, ‘add_filter_upload_image’, 10, 1);
For example is the best way to do this something like hooking into add_attachment and then modify the gallery field?
I hacked my by removing the this.add_events code, so it doesn’t do it anymore. I think you are right about it being load time related.
When I remove the call of “this.add_events” from the input.min.js file, init function, the issue goes away.
Could it be that the body is being accessed before the editor is initialized? That would make sense…
Cached JS would make sense but I don’t see why after a month it doesn’t clear.
Also the issue comes and goes. It works, then doesn’t, then works again.
I registered you. You should receive email.
I am still having this issue. I don’t understand. What is the solution?
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.