I’ve created a form that contains upload and gallery fields.
Upload field works fine, instead the gallery field generates a query error when I click on “Add to gallery” button.
If I logged in, the gallery field works and media popup appears.
This is the jQuery error that I see in js console
[Error] TypeError: undefined is not an object (evaluating ‘wp.media.query’)
popup (acf-input.min.js, line 1)
add_attachment (acf-pro-input.min.js, line 1)
(funzione anonima) (acf-input.min.js, line 1)
dispatch (jquery.min.js, line 3)
handle (jquery.min.js, line 3)
I would that gallery field works in frontend form, without the user is logged in.
Can you help me?
It does not appear that the gallery field works when not logged in. I’ve tried everything I can think of here.
Your bet for doing this if you want to allow the user to create a gallery on the front end without being logged in would be to give them a repeater field with image fields for uploading multiple images and then to create an acf/save_post action to take the images from the repeater and add them to the gallery field.
The problem is that in order to use the gallery field the user has to have access to the media library. Any user type that does not have access to editing the media library will cause a JS error.
I think this means that the user must be at least a contributor, maybe an author.
I’m using WP 6.0, ACF Pro 5.12.2 with Oxygen 3.9 and I’m getting the same error msg: undefined is not an object (evaluating ‘wp.media.query’) when trying to add/edit an ACF image field in the front end using the standard acf_form(),
even after adding the wp_enqueue_media() within admin_enqueue_scripts and also using User role editor plugin. Do you have any suggestions to fix this issue?
Thanks in advance,
The topic ‘frontend gallery field’ is closed to new replies.
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!